I have a very simple shell script, called deploy.sh
#!/bin/sh
CDIR= $(pwd)
echo Hello World!
Unfortunately, running it gives the following error:
bird@bird-laptop:~/foo$ sh deploy.sh
deploy.sh: 3: deploy.sh: /home/bird/foo: Permission denied
Hello World!
Any clues, why this is happening?
bird@bird-laptop:~/foo$ ls -l
total 156
-rwxrwxrwx 1 bird bird 327 April 18 00:57 deploy.sh
-rw-r--r-- 1 bird bird 327 April 18 00:53 deploy.sh~
Remove the space character after the =
in
CDIR= $(pwd)
sh
doesn't allow any spaces around the =
.
CDIR= $(pwd)
means "Run the output of pwd
with the variable CDIR
unset."
As you can't run a folder you get Permission denied
.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments