#!/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