summaryrefslogtreecommitdiff
path: root/home/xyz/.local/bin/mvt
blob: 716c0eaa76f267269e1c257041d5eb9b91e6c499 (plain)
1
2
3
4
5
6
7
8
#!/bin/sh
# emulate mv -t, for use with `find ... -exec mvt ... '{}' \+`, more POSIX compliant
# example: mvt ./dir/ -i -- file1 file2

dist="$1"
shift
# not use -- here, use -- when use mvt, so I can specify -f or -i switch before -- when use mvt
mv "$@" "$dist"
cfF:t:T: opt; do case $opt in c) tz_from="Asia/Shanghai";; f) tz_from="$(tzselect)";; F) tz_from="$OPTARG";; # one extra ',' at the end will not let `for tz in ...` loop one extra time? t) for i in $(seq "$OPTARG"); do tz_to="$(tzselect),$tz_to" done;; T) tz_to="$OPTARG,$tz_to";; \?) exit 1;; esac done shift $((OPTIND-1))