This question already has an answer here:
- Command not found error in Bash variable assignment 5 answers
- Variable variable assignment error -“command not found” 1 answer
- Why does a space in a variable assignment give an error in Bash? [duplicate] 3 answers
So I've got a shell script to do some lazy stuff for if the directory isn't changing for a user. It's below. Essentially, it should be an if statement that if the user enters "default" for the directory, it'll pull them to the default directory for the files. However, I'm getting a command not found
on line 16, which is the reassignment statement.
The entire if
statement below:
if [ $directory = "default" ];
then
echo Enter your ldap:
read $ldap
$directory = "/usr/local/home/google/${ldap}/Downloads"
fi
I've tried doing it without the dollar sign too...nothing. What's going on here? New to shell, couldn't find this question asked before either.