Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A shell script to set Terminal window colors per SSH host' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A shell script to set Terminal window colors per SSH host
Authored by: capacity on Aug 02, '05 05:29:41PM
fungus, can you please explain in a little more detail? I'm new to this shell script stuff, and I'm not exactly sure how to change the host=${1:-${0##*/}} line to do what you're talking about (I think that's what you're referring to). Also, I have ~/bin/ in my PATH, but would I have to chmod +x ssh_host.sh? thanks.

[ Reply to This | # ]
A shell script to set Terminal window colors per SSH host
Authored by: jdsmith on Aug 03, '05 12:43:14PM
The script already works that way. It can either take a single argument (the ssh host name), or use the base name of the linked command name. To get your functionality, simply:
% alias ssh ssh_host
% ssh hostname

By the way, the ".sh" in the name of the downloaded file is just there to ensure the special characters are downloaded correctly. It can safely be stripped, so the script is just called ssh_host.

For the interested, host=${1:-${0##*/}} is just shell magic for "use the first argument, unless it isn't set, in which case use the command name, stripped of any leading path". JD

[ Reply to This | # ]