commit a920acf5d32084f8d6f6f1eddc09b56f63f9f9f6 parent 74f77ff43de07fc323a5911a2615d22b895ad4a6 Author: Alex Balgavy <alex@balgavy.eu> Date: Tue, 27 Jul 2021 15:44:36 +0200 mpcq: make it work from emacs diredit Diffstat:
M | scripts/mpcq | | | 12 | ++++++------ |
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/scripts/mpcq b/scripts/mpcq @@ -48,22 +48,22 @@ while [ $(($#)) -ne 0 ]; do exit 1 ;; *) # preserve positional arguments - PARAMS="$PARAMS $(printf '%q' "$1")" + PARAMS="$PARAMS $(printf %s "$1")" shift ;; esac done eval set -- "$PARAMS" -if ! [ -t 0 ]; then +if ! [ -t 0 ] && [ $# -eq 0 ]; then while read -r line; do - fpath="$(realpath "$line")" - [ -f "$fpath" ] && queue "$fpath" + filepath="$(realpath "$line")" + [ -f "$filepath" ] && queue "$filepath" done elif [ $# -gt 0 ]; then for f in "$@"; do - fpath="$(realpath "$f")" - [ -f "$fpath" ] && queue "$fpath" + filepath="$(realpath "$f")" + [ -f "$filepath" ] && queue "$filepath" done else die "Files expected as arguments or on stdin."