Skip to content

Instantly share code, notes, and snippets.

@alanxoc3
Created April 10, 2018 08:54
Show Gist options
  • Save alanxoc3/fc135e33fde1fbad26b1defd849d15a5 to your computer and use it in GitHub Desktop.
Save alanxoc3/fc135e33fde1fbad26b1defd849d15a5 to your computer and use it in GitHub Desktop.
A simple script that opens up xterm with a command or an alias!!!
#!/bin/bash
# For running commands on xterm startup.
# The newline is needed, because bash does weird things with aliases. Bash
# needs a line before the shopt command takes effect. That was a wild goose
# chase!
# http://www.delorie.com/gnu/docs/bash/bashref_72.html
xtermcmd() {
xterm -e "bash --rcfile <(echo -e \"shopt -s expand_aliases; . ~/.bashrc;\n$*\")"
}
xtermcmd "$*"
@alanxoc3
Copy link
Author

It looks simple, but it was a pain. Partly because of xterm and partly because of weird quirks with bash and aliases. But it works now! You can supply your alias to this simple script and it will run your alias in a terminal! Yahoo!

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