2

I have a shell script in my home folder:

copy.sh

mkdir new_folder

when I ran the shell script from my home folder:

./copy.sh

I got error message:

-bash: ./copy.sh: Permission denied

Why?

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
Victor
  • 455
  • 1
  • 5
  • 10
  • possible duplicate of [shell scrip run when I am root but I get a permission denied when it is invoked from a Makefile (still as root)](http://stackoverflow.com/questions/28332397/shell-scrip-run-when-i-am-root-but-i-get-a-permission-denied-when-it-is-invoked) – Markus W Mahlberg Apr 13 '15 at 18:03

1 Answers1

2

You have to give the script execution permission:

chmod +x path_to_the_copy.sh
Jahid
  • 19,822
  • 8
  • 86
  • 102
  • Another option is to call the shell command and give the script as a parameter (This is not a permanent solution), like this: `bash path_to_the_copy.sh` or if you want to have a verbose output: `bash -x path_to_the_copy.sh` – Yaron Dec 17 '15 at 12:00