Skip to content
This repository has been archived by the owner on Nov 11, 2018. It is now read-only.

Check if script is executable in first place #39

Open
kaustubhhiware opened this issue Jun 3, 2017 · 0 comments
Open

Check if script is executable in first place #39

kaustubhhiware opened this issue Jun 3, 2017 · 0 comments

Comments

@kaustubhhiware
Copy link

kaustubhhiware commented Jun 3, 2017

To test maybe, I wrote a simple script

$ cat demo.sh 
rm -rf temp123
mkdir temp123
$ maybe ./demo.sh
- Error executing ./demo.sh: [Errno 13] Permission denied.
$ sudo maybe ./demo.sh
- Error executing ./demo.sh: [Errno 13] Permission denied.

I tried giving it the appropriate rights

$ sudo chmod 777 demo.sh 
$ sudo maybe ./demo.sh
- Error executing ./demo.sh: [Errno 8] Exec format error.

I added the line #!/bin/sh to the top, and this gave the desired output.

$ sudo maybe ./demo.sh
maybe has prevented ./demo.sh from performing 2 file system operations:

  delete pwd/temp123
  create directory pwd/temp123

Do you want to rerun ./demo.sh and permit these operations? [y/N] n

Is it possible to detect, if the script could have been run in the first place, instead of showing these errors ?

@kaustubhhiware kaustubhhiware changed the title Error while executing simple script Check if script is executable in first place Jun 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant