I'm trying to compare the current working directory's path with my home directory's path.
user@machine:~$ echo $PWD
/home/user
user@machine:~$ if ["$PWD" = "/home/user"]; then echo True; else echo False; fi
bash: [/home/user: No such file or directory
False
user@machine:~$ if ["$PWD" = "whatever"]; then echo True; else echo False; fi
bash: [/home/user: No such file or directory
False
I expected it to print True in the second command and False in the third, while not printing bash: [/home/user: No such file or directory. Why is it printing this and how do I get it to work as I wanted to?
[or]and the string. Tryif [ "$PWD" = "/home/user" ]; then... It is printing the error message because it tries to find a command[/home/userinstead of[followed by argument/home/user.