From 6684e42b12010c4216fb2ce661546130066c49dc Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Thu, 29 Feb 2024 19:41:40 -0800 Subject: [PATCH] chx: clean up code style, remove impossible condition --- .config/shell/bin/chx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.config/shell/bin/chx b/.config/shell/bin/chx index f5223a7..5bfd1d0 100755 --- a/.config/shell/bin/chx +++ b/.config/shell/bin/chx @@ -2,15 +2,13 @@ # toggles whether a file or group of files is executable -for FILE in "$@";do - if [ -x "$FILE" ];then - chmod -x "$FILE" && +for FILE; do + if [ -x "./$FILE" ]; then + chmod -x "./$FILE" && echo -e "$FILE: -x" - elif ! [ -x "$FILE" ];then - chmod +x "$FILE" && + elif ! [ -x "./$FILE" ]; then + chmod +x "./$FILE" && echo -e "$FILE: +x" - else - echo "error: file $FILE does not exist" >&2 fi done