Files
bash-programming-from-scratch/manuscript/resources/code/BashScripting/tar-wrapper-array.sh
2020-10-17 10:22:39 +02:00

18 lines
276 B
Bash

#!/bin/bash
option="$1"
declare -A utils=(
["-b"]="bsdtar"
["--bsdtar"]="bsdtar"
["-t"]="tar"
["--tar"]="tar")
if [[ -z "$option" || ! -v utils["$option"] ]]
then
echo "Указана недопустимая опция"
exit 1
fi
${utils["$option"]} "${@:2}"