diff options
author | xyz <gky44px1999@gmail.com> | 2021-11-14 18:40:27 -0800 |
---|---|---|
committer | xyz <gky44px1999@gmail.com> | 2021-11-14 18:40:27 -0800 |
commit | 2ab43840fbf46b7e6c0b9683016e64c0a0d062a6 (patch) | |
tree | 16a19e44354da7baa8fb0082c45c283ec6fa3831 /home/xyz/.local | |
parent | cda9c85bd3ee0f894a2fb193b984a22543f01124 (diff) |
redirect to /dev/null instead
Diffstat (limited to 'home/xyz/.local')
-rwxr-xr-x | home/xyz/.local/bin/o | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/home/xyz/.local/bin/o b/home/xyz/.local/bin/o index 20cf2ede..d70a6d76 100755 --- a/home/xyz/.local/bin/o +++ b/home/xyz/.local/bin/o @@ -8,13 +8,18 @@ # I don't care about errors, I don't want to handle 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<&- >&- 2>&- & + nohup "$cmd" "$1" 0<&- >/dev/null 2>&1 & else - nohup "$@" 0<&- >&- 2>&- & + nohup "$@" 0<&- >/dev/null 2>&1 & fi |