Reputation: 1
I try to built a Programm where I can create Text-Files and folders. The user can type in i.a. the directory. To check if the given path exits I created a while-loop but it doesn’t work. My question is where are my errors and how can I fix them.
while [[ test -e $path == false]]
do echo “type in a valid path”
read -r path
done
Error:
./Create: line 28: conditional binary operator expected
./Create: line 28: syntax error near `e'
./Create: line 28: `while [[ test -e $path == false ]]'
Upvotes: 0
Views: 64
Reputation: 40688
I found a couple of issues:
[[
or test
, but not bothfalse
is not a constant in bashThe fix:
while [[ ! -e $path ]]
do
....
done
Upvotes: 4