diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/free-port | 2 | ||||
-rwxr-xr-x | bin/grun | 2 | ||||
-rwxr-xr-x | bin/max | 2 | ||||
-rwxr-xr-x | bin/menu | 4 | ||||
-rwxr-xr-x | bin/min | 2 | ||||
-rwxr-xr-x | bin/mkdtemp | 2 | ||||
-rwxr-xr-x | bin/mkstemp | 2 | ||||
-rwxr-xr-x | bin/msg | 2 | ||||
-rwxr-xr-x | bin/muffle | 6 | ||||
-rwxr-xr-x | bin/player | 14 | ||||
-rwxr-xr-x | bin/playlist | 4 | ||||
-rwxr-xr-x | bin/repos | 8 | ||||
-rwxr-xr-x | bin/tmpname | 2 | ||||
-rwxr-xr-x | bin/vcs | 12 | ||||
-rwxr-xr-x | bin/vm | 10 |
15 files changed, 37 insertions, 37 deletions
diff --git a/bin/free-port b/bin/free-port index 30ed0ff..e3b5a20 100755 --- a/bin/free-port +++ b/bin/free-port @@ -75,4 +75,4 @@ while true; do fi done -echo "$PORT" +printf '%s\n' "$PORT" @@ -98,4 +98,4 @@ fi # GPG recipients can't contain spaces: # shellcheck disable=2086 -echo "$OUT" | gpg -e ${RECIPIENTS_FLAG:--r eu@euandre.org} | sponge "$FILENAME" +printf '%s\n' "$OUT" | gpg -e ${RECIPIENTS_FLAG:--r eu@euandre.org} | sponge "$FILENAME" @@ -88,4 +88,4 @@ N="$1" for n in "$@"; do N=$((N > n ? N : n)) done -echo "$N" +printf '%s\n' "$N" @@ -113,8 +113,8 @@ case "$ACTION" in emoji) CHOICE="$(DATA | show 'emoji')" if [ -n "$CHOICE" ]; then - EMOJI="$(echo "$CHOICE" | awk '{print $(NF)}')" - echo "$EMOJI" | copy -n + EMOJI="$(printf '%s\n' "$CHOICE" | awk '{print $(NF)}')" + printf '%s\n' "$EMOJI" | copy -n notify-send -t 5000 -u normal -- \ "$EMOJI" 'emoji copied to clipboard' fi @@ -88,4 +88,4 @@ N="$1" for n in "$@"; do N=$((N < n ? N : n)) done -echo "$N" +printf '%s\n' "$N" diff --git a/bin/mkdtemp b/bin/mkdtemp index 8e5fb48..3c920a8 100755 --- a/bin/mkdtemp +++ b/bin/mkdtemp @@ -62,4 +62,4 @@ shift $((OPTIND - 1)) name="$(tmpname)" mkdir "$name" -echo "$name" +printf '%s\n' "$name" diff --git a/bin/mkstemp b/bin/mkstemp index 2c0cdbc..ec0d744 100755 --- a/bin/mkstemp +++ b/bin/mkstemp @@ -62,4 +62,4 @@ shift $((OPTIND - 1)) name="$(tmpname)" touch "$name" -echo "$name" +printf '%s\n' "$name" @@ -138,7 +138,7 @@ if [ "$SOUND" = true ]; then fi if [ "$SPEAK" = true ]; then eval "$(assert-arg -- "$MESSAGE" '-S MESSAGE')" - echo "$MESSAGE" | speak -v pt-BR & + printf '%s\n' "$MESSAGE" | speak -v pt-BR & fi if [ "$MAIL" = true ]; then eval "$(assert-arg -- "$MESSAGE" '-m MESSAGE')" @@ -83,10 +83,10 @@ STATUS="$(cat "$STATUS_F")" if [ "$STATUS" != 0 ]; then cat "$OUT" "$ERR" | sort -k2 | while read -r line; do - if [ "$(echo "$line" | cut -d' ' -f1)" = 'out:' ]; then - echo "$line" | cut -d' ' -f3- >&1 + if [ "$(printf '%s\n' "$line" | cut -d' ' -f1)" = 'out:' ]; then + printf '%s\n' "$line" | cut -d' ' -f3- >&1 else - echo "$line" | cut -d' ' -f3- >&2 + printf '%s\n' "$line" | cut -d' ' -f3- >&2 fi done exit "$STATUS" @@ -83,24 +83,24 @@ CURRENT_PLAYER="$(cat "$CURRENT_PLAYER_PATH" ||:)" AVAILABLE_PLAYERS="$(playerctl --list-all | LANG=POSIX.UTF-8 sort)" pick_first() { - echo "$AVAILABLE_PLAYERS" | head -n1 + printf '%s\n' "$AVAILABLE_PLAYERS" | head -n1 } next_player() { if [ -z "$CURRENT_PLAYER" ]; then pick_first - elif ! echo "$AVAILABLE_PLAYERS" | grep -q "$CURRENT_PLAYER"; then + elif ! printf '%s\n' "$AVAILABLE_PLAYERS" | grep -q "$CURRENT_PLAYER"; then # Unknown $CURRENT_PLAYER, pick anyone pick_first else - INDEX="$(echo "$AVAILABLE_PLAYERS" | grep -n "$CURRENT_PLAYER" | cut -d: -f1)" - LENGTH="$(echo "$AVAILABLE_PLAYERS" | wc -l)" + INDEX="$(printf '%s\n' "$AVAILABLE_PLAYERS" | grep -n "$CURRENT_PLAYER" | cut -d: -f1)" + LENGTH="$(printf '%s\n' "$AVAILABLE_PLAYERS" | wc -l)" if [ "$INDEX" = "$LENGTH" ]; then # Reached the end of the $AVAILABLE_PLAYERS list, wrapping pick_first else # Get the next player instead - echo "$AVAILABLE_PLAYERS" | awk -v idx="$INDEX" 'NR == idx+1 {print}' + printf '%s\n' "$AVAILABLE_PLAYERS" | awk -v idx="$INDEX" 'NR == idx+1 {print}' fi fi } @@ -146,14 +146,14 @@ case "$ACTION" in ;; rotate) PLAYER="$(next_player)" - echo "$PLAYER" > "$CURRENT_PLAYER_PATH" + printf '%s\n' "$PLAYER" > "$CURRENT_PLAYER_PATH" notify-send -t 1000 -- \ "$(printf '%s' "$PLAYER" | format_player_name)" \ 'current MPRIS target' ;; synopsis) printf '%s: %s\n' \ - "$(echo "$CURRENT_PLAYER" | format_player_name)" \ + "$(printf '%s\n' "$CURRENT_PLAYER" | format_player_name)" \ "$(formatted_player_title)" ;; *) diff --git a/bin/playlist b/bin/playlist index bfb609e..0c29169 100755 --- a/bin/playlist +++ b/bin/playlist @@ -75,7 +75,7 @@ F="$XDG_DATA_HOME"/euandreh/playlist.txt prompt() { ENTRY="$(zenity --text 'URL of the video to enqueue:' --entry ||:)" if [ -n "$ENTRY" ]; then - echo "$ENTRY" >> "$F" + printf '%s\n' "$ENTRY" >> "$F" fi } @@ -85,7 +85,7 @@ run() { return fi mpv "$next" - echo "$next" >> "queue.$F" + printf '%s\n' "$next" >> "queue.$F" tail -n+2 "$F" | sponge "$F" } @@ -77,15 +77,15 @@ arr_push() { ARR="$1" ELT="$2" if [ -n "$ARR" ]; then - echo "$ARR" + printf '%s\n' "$ARR" fi - echo "$ELT" # | array_encode (see CAVEAT) + printf '%s\n' "$ELT" # | array_encode (see CAVEAT) } arr_includes() { ARR="$1" ELT="$2" - echo "$ARR" | while read -r el; do + printf '%s\n' "$ARR" | while read -r el; do # if [ "$(printf '%s\n' "$el" | array_decode)" = "$ELT" ]; then (see CAVEAT) if [ "$el" = "$ELT" ]; then return 2 @@ -133,7 +133,7 @@ shift $((OPTIND - 1)) is_repository() { TYPE="$(vcs -C "$1" -t 2>/dev/null)" if [ -n "$TYPE" ]; then - echo "$1" + printf '%s\n' "$1" else return 1 fi diff --git a/bin/tmpname b/bin/tmpname index 5b732a5..f16816e 100755 --- a/bin/tmpname +++ b/bin/tmpname @@ -64,4 +64,4 @@ while getopts 'h' flag; do done shift $((OPTIND - 1)) -echo "${TMPDIR:-/tmp}/uuid-tmpname with spaces.$(uuid)" +printf '%s\n' "${TMPDIR:-/tmp}/uuid-tmpname with spaces.$(uuid)" @@ -68,15 +68,15 @@ git_diff() { git_ps1() { BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)" OUT="$(git status --short --branch --porcelain)" - BRANCH_LINE="$(echo "$OUT" | head -n 1)" - DIFF_LINES="$(echo "$OUT" | tail -n +2)" + BRANCH_LINE="$(printf '%s\n' "$OUT" | head -n 1)" + DIFF_LINES="$(printf '%s\n' "$OUT" | tail -n +2)" IS_AHEAD=false IS_BEHIND=false - if echo "$BRANCH_LINE" | grep -q 'ahead'; then + if printf '%s\n' "$BRANCH_LINE" | grep -q 'ahead'; then IS_AHEAD=true fi - if echo "$BRANCH_LINE" | grep -q 'behind'; then + if printf '%s\n' "$BRANCH_LINE" | grep -q 'behind'; then IS_BEHIND=true fi @@ -94,10 +94,10 @@ git_ps1() { HAS_DIFF=false HAS_UNTRACKED=false - if echo "$DIFF_LINES" | grep -q '^[A|D|M| ][M|D| ]'; then + if printf '%s\n' "$DIFF_LINES" | grep -q '^[A|D|M| ][M|D| ]'; then HAS_DIFF=true fi - if echo "$DIFF_LINES" | grep -Eq '^([?][?]| A)'; then + if printf '%s\n' "$DIFF_LINES" | grep -Eq '^([?][?]| A)'; then HAS_UNTRACKED=true fi @@ -163,7 +163,7 @@ mkdir -p "$RUNDIR" "$QCOW_DIR" "$XDG_DATA_HOME"/vm "$(dirname "$LOGS")" guess_name() { PREFIX="$1" IMAGES="$(find "$QCOW_DIR" '(' -type f -or -type l ')' -name "${PREFIX}*")" - COUNT="$(echo "$IMAGES" | wc -l)" + COUNT="$(printf '%s\n' "$IMAGES" | wc -l)" if [ "$COUNT" != 1 ]; then printf 'Cannot guess name with the given prefix: "%s".\n' "$PREFIX" >&2 printf '\nThe possibilities are:\n' >&2 @@ -181,7 +181,7 @@ guess_name() { } guess_arch() { - NAME="$(echo "$1" | cut -d- -f2)" + NAME="$(printf '%s\n' "$1" | cut -d- -f2)" case "$NAME" in amd64) printf 'x86_64' @@ -194,8 +194,8 @@ guess_arch() { hostfwd() { for m in "$@"; do - HOST="$( echo "$m" | cut -d: -f1)" - GUEST="$(echo "$m" | cut -d: -f2)" + HOST="$( printf '%s\n' "$m" | cut -d: -f1)" + GUEST="$(printf '%s\n' "$m" | cut -d: -f2)" printf ',hostfwd=tcp::%s-:%s' "$HOST" "$GUEST" done } @@ -304,7 +304,7 @@ case "$ACTION" in $FLAGS "$@" if [ "$DRY_RUN" = true ]; then - echo "$@" + printf '%s\n' "$@" exit fi |