From 20709434e3fcd3802ac4c9e97cdeac4649bd0276 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Sat, 11 Dec 2021 02:18:11 +0100 Subject: [PATCH] config/shell/functions: adjust syntax for full bash-compatibility --- .config/shell/functions | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.config/shell/functions b/.config/shell/functions index e25cc06..a2bf90d 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -114,7 +114,7 @@ t() { then tn else if test "$1" = "do" - then test "$2" -gt 0 2>/dev/null && task mod sched:today "${@:2}" || task add sched:today "${@:2}" + then shift && test "$1" -gt 0 2>/dev/null && task mod sched:today "$@" || task add sched:today "$@" else task "$@" fi fi @@ -203,18 +203,18 @@ alias mdox="xclip -o -selection clipboard | mdo | xclip -filter" alias gdiff='git diff --word-diff=color --word-diff-regex=. --no-index' alias grp='grep --color=auto --line-number --ignore-case --binary-files=without-match --directories=skip' -grpr() { grp --color=always --recursive $(echo $DIRS_IGNORE | sed 's/-x/--exclude-dir/g') "$@" | less -F } +grpr() { grp --color=always --recursive $(echo $DIRS_IGNORE | sed 's/-x/--exclude-dir/g') "$@" | less -F; } # Recover stray swap files from neovim alias vrec="ls $XDG_DATA_HOME/nvim/swap | sed 's/\%/\//g' | sed 's|\(.*\)\..*|\1|' | head -1 | xargs --no-run-if-empty nvim" alias vrecd="ls $XDG_DATA_HOME/nvim/swap | head -1 | xargs -r -i mv {} /tmp" # I think this was something about recovering backup files -unv() { strings $1 | sed 's/5$//' | dedup } +unv() { strings $1 | sed 's/5$//' | dedup; } alias hx='sudo hexedit --maximize --color' # Paginated hexyl -hex() { hexyl "$@" | "${PAGER:-less}" } +hex() { hexyl "$@" | "${PAGER:-less}"; } alias dic="cat $XDG_DATA_HOME/dictcc/dict.txt | sed '/#/d;/&/d;/^$/d' | fzf --tiebreak=length --bind='alt-bspace:clear-query'" alias dict="rlwrap rdictcc -d $XDG_DATA_HOME/dictcc" @@ -231,8 +231,8 @@ npm-reinstall() { # Custom tools {{{1 -sedcomment() { sed -i 's/$1/#\0/' "${@:2}" } -seduncomment() { sed -i 's/#\($1\)/\0/' "${@:2}" } +sedcomment() { sed -i "s/$1/#\0/" "${@:2}"; } +seduncomment() { sed -i "s/#\($1\)/\0/" "${@:2}"; } updateDeps() { name="$1"