Created
April 1, 2016 04:03
-
-
Save quickgrid/10f6be3e31ae582e148171ce4c1aac37 to your computer and use it in GitHub Desktop.
The code below checks if the given command line argument is a regular file. If it is then it checks if the file is executable. Finally if the file is executable the code removes the execution permission for the owner.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
removeExecutablePermission(){ | |
if [ -f $1 ]; then | |
#echo "regular file" | |
if [ -x $1 ]; then | |
#echo "remove permission" | |
chmod o-x $1 | |
fi | |
fi | |
} | |
removeExecutablePermission "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment