1

I read in Stack Exchange that the message I am getting, "No such file or directory” refers to not being in the directory where the file I need resides. The article suggested using “cd" to change the directory. I did and ran the “chmod +x first deploy.sh”. The result was: chmod: first: No such file or directory” the next line contained: “chmod: deploy.sh: No such file or directory”

Next I went to: "sudo chmod +x deploy.sh”. received the request for my password, I entered my administrator password and received: “chmod: deploy.sh: No such file or directory.

William Mayfield
  • 11
  • 1
  • 1
  • 2

1 Answers1

2

In all Linux commands, a space is treated as a separator that separates command arguments. So if you try to do chmod +x first deploy.sh the command understands that you want to change permissions on two files: first and deploy.sh. I guess none of these files exists, so you get "No such file or directory" error.

Whenever you want to use a file name that contains spaces, you need to quote it, that is, enclose in either single or double quotes, like: chmod +x "first deploy.sh". You may also quote the space itself, preceding it with a backslash: chmod +x first\ deploy.sh.

Personally I would suggest avoiding filenames with spaces and changing the file name to first_deploy.sh - it will be easier to use. It's a common convention to use underscores in filenames that consist of multiple words.

raj
  • 11,409