bin/bak: improve suffix handling
This commit is contained in:
parent
d59029e968
commit
51da712040
|
@ -139,6 +139,7 @@ alias tw='timew'
|
||||||
twsm() { timew summary $(date --date="Monday $1 week ago" -I) to tomorrow :ids ${@:2} }
|
twsm() { timew summary $(date --date="Monday $1 week ago" -I) to tomorrow :ids ${@:2} }
|
||||||
alias twtest='( cp -r "$TIMEWARRIORDB" /tmp/tw-bak && TIMEWARRIORDB=/tmp/timewarriordb-test/$(date +%s) && mkdir -p "$TIMEWARRIORDB"/data && :> "$TIMEWARRIORDB"/timewarrior.cfg && $SHELL )'
|
alias twtest='( cp -r "$TIMEWARRIORDB" /tmp/tw-bak && TIMEWARRIORDB=/tmp/timewarriordb-test/$(date +%s) && mkdir -p "$TIMEWARRIORDB"/data && :> "$TIMEWARRIORDB"/timewarrior.cfg && $SHELL )'
|
||||||
|
|
||||||
|
alias expr='noglob expr'
|
||||||
alias lst='( last; last -f /var/log/wtmp.1 ) | grep -v "pts/" | tac | less +G'
|
alias lst='( last; last -f /var/log/wtmp.1 ) | grep -v "pts/" | tac | less +G'
|
||||||
alias lar='last | tac'
|
alias lar='last | tac'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
suffix="${2:-bak}"
|
suffix="${2:-bak}"
|
||||||
test -e "$1.$suffix" && ((test -e "$1" && mv -v "$1" /tmp); mv -vn "$1.$suffix" "$1") || mv -vn "$1" "$1.$suffix"
|
orig="${1%%.$suffix}"
|
||||||
|
echo $orig
|
||||||
|
if test -e "$orig.$suffix"
|
||||||
|
then
|
||||||
|
test -e "$orig" && mv -v "$orig" /tmp
|
||||||
|
mv -vn "$orig.$suffix" "$orig"
|
||||||
|
else mv -vn "$1" "$1.$suffix"
|
||||||
|
fi
|
||||||
|
|
|
@ -5,8 +5,11 @@ if test -f "$subscript"
|
||||||
then shift && $subscript "$@"
|
then shift && $subscript "$@"
|
||||||
else
|
else
|
||||||
apikey=$(grep apikey $XDG_CONFIG_HOME/syncthing/config.xml | cut -d '>' -f2 | cut -d '<' -f1)
|
apikey=$(grep apikey $XDG_CONFIG_HOME/syncthing/config.xml | cut -d '>' -f2 | cut -d '<' -f1)
|
||||||
|
parseargs() {
|
||||||
|
echo hi
|
||||||
|
}
|
||||||
case "$1" in
|
case "$1" in
|
||||||
(browse|need)
|
(browse|completion|file|ignores|need|status)
|
||||||
for arg in "${@:2}"
|
for arg in "${@:2}"
|
||||||
do case "$arg" in ([0-9]) depth=$arg;; (*) path="$arg";; esac
|
do case "$arg" in ([0-9]) depth=$arg;; (*) path="$arg";; esac
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue