claudio schwarz purzlbaum kaxleb7obdk unsplash 2

Suppose you want to to start an XWindow program from a terminal with its input, output, and error output redirected to null (/dev/null). Moreover you want the started program not to be hit with SIGHUP signal and exited when you close the terminal window from which you’ve started it:

x glxgears

It can be done with the following script:

#!/bin/bash

cmd="$1"
if ! { which "$cmd" > /dev/null; }; then
    echo "x: $cmd not found."
else
    "$@" >/dev/null 2>&1 &
    disown
fi

Well, somebody make Debian and .rpm packages with this short script.

Tags:
Chat Icon