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"
le errors, just shut up please. # nohup seems not necessary if don't care about daemon SIGHUP requirement # when close a shell script's stdout or stderr with `>&-` or `2>&-`, `xsel -ib` in that script has no effect # https://github.com/kfish/xsel/issues/43 # using `>&-` or `2>&-` doesn't completely close mpv's output when run sth. like `o mpv file.mkv` # base on above observations, I choose to use `>/dev/null 2>&1` instead if [ $# -eq 1 ] && [ -e "$1" ] && { ! [ -x "$1" ] || [ -d "$1" ];}; then case "$1" in # libreoffice, please don't let firefox eat your shit *.docx|*.pptx) cmd=libreoffice;; *) cmd=xdg-open;; esac nohup "$cmd" "$1" 0<&- >/dev/null 2>&1 & else nohup "$@" 0<&- >/dev/null 2>&1 & fi