dotfiles/.config/shell/bin/chx

17 lines
328 B
Text
Raw Normal View History

#!/bin/bash
# toggles whether a file or group of files is executable
for FILE in "$@";do
if [ -x "$FILE" ];then
chmod -x "$FILE" &&
echo -e "$FILE: -x"
elif ! [ -x "$FILE" ];then
chmod +x "$FILE" &&
echo -e "$FILE: +x"
else
echo "error: file $FILE does not exist" >&2
fi
done