Skip to content

Instantly share code, notes, and snippets.

@sohang3112
Last active October 8, 2022 01:15
Show Gist options
  • Save sohang3112/77f0ce53b243e0ab133f482a01b3d0e7 to your computer and use it in GitHub Desktop.
Save sohang3112/77f0ce53b243e0ab133f482a01b3d0e7 to your computer and use it in GitHub Desktop.
Open GUI program, detached from shell
#!/bin/bash
if [ $# -gt 0 ] ; then
  ($@ &) &>/dev/null
else
  cat <<-EOM
    Usage: gui [COMMAND] [ARG]...
    
    Runs a command in GUI mode, i.e., detached completely from the executing shell and terminal.
    If no command is given, this help message is shown.
EOM
fi

Instructions

  • Save above script in a file called gui somewhere on the user's PATH (environment variable).
  • Make it executable: chmod +x <PATH_TO_FILE>/gui (enter the script's path in place of <PATH_TO_FILE>).

Note: This script was inspired from this Stack Overflow answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment