The error comes from the fact that
[(0)'s last argument
must be «
] ».
Here, its last argument is «
TAK] ».
if keyword
must be followed by
then on a newline, as does
elif.
If you want
then to be on the same line as the
if or
elif, put a semicolon before it.
-eq is used to test integers; you want
= here.
Also, in
bash(1) it's preferred to use the keyword
[[ instead.
I would write it like this:
Code:
#!/bin/bash
read -rp 'Utworzyć nowy katalog {TAK/NIE}? ' zmienna
if [[ $zmienna != TAK ]]; then
echo 'koniec...'
exit
fi
read -rp 'Podaj nazwę katalogu : ' katalog
if [[ ! -d $katalog ]]; then
mkdir "$katalog" || exit 1
fi