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,738
  • 21
  • 105
  • 131
Victor
  • 515
  • 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
  • 21,542
  • 10
  • 90
  • 108
  • 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
  • This did not seem to work for me . i still get a permission denied error – Jono Jun 30 '22 at 11:04