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

Check if script is executable in first place #39

Description

@kaustubhhiware

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 ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions