mirror of
https://github.com/Ahwxorg/nixos-config.git
synced 2025-12-05 07:05:40 +01:00
change scripts
This commit is contained in:
parent
be42d058cb
commit
27e0c22bae
10 changed files with 86 additions and 72 deletions
16
modules/home/scripts/scripts/runbg.sh
Normal file
16
modules/home/scripts/scripts/runbg.sh
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
[ $# -eq 0 ] && { # $# is number of args
|
||||
echo "$(basename $0): missing command" >&2
|
||||
exit 1
|
||||
}
|
||||
prog="$(which "$1")" # see below
|
||||
[ -z "$prog" ] && {
|
||||
echo "$(basename $0): unknown command: $1" >&2
|
||||
exit 1
|
||||
}
|
||||
shift # remove $1, now $prog, from args
|
||||
tty -s && exec </dev/null # if stdin is a terminal, redirect from null
|
||||
tty -s <&1 && exec >/dev/null # if stdout is a terminal, redirect to null
|
||||
tty -s <&2 && exec 2>&1 # stderr to stdout (which might not be null)
|
||||
"$prog" "$@" & # $@ is all args
|
||||
Loading…
Add table
Add a link
Reference in a new issue