On Wed, 20 Jun 2018, John Jason Jordan wrote:

On Wed, 20 Jun 2018 05:52:06 -0700 (PDT)
Rich Shepard <[email protected]> dijo:

On Tue, 19 Jun 2018, wes wrote:

Alias! Alias is prezackly what I was looking for!

I knew there had to be a way!

alias is good for string:string conversions, and probably just what you want. If there ever comes a point where you want to have options that get interpolated into the output string, then a function may be the ticket.

I have a handful of machines in my home domain; I ssh into all of them fairly regularly. I'm not a fan of using short hostnames for ssh logins, so I have this habit of only using fully qualified domain names. Of course, all that typing is a nuisance. So I conconcted a simple function:

  mli ()
  {
    ssh $1.madboa.com
  }

So

  mli clayton

becomes

  ssh clayton.madboa.com

This works even better with bash's complete utility:

  complete -W 'arrowhead clayton omega silver tunnel' mli

Which allows me to tab-complete hostnames from the shell prompt when using the mli function.

A couple years ago, I posted to my web site a more complex example that allows optional positional parameters:

  https://www.madboa.com/blog/2015/09/28/ipmicli-function/

--
Paul Heinlein
[email protected]
45°38' N, 122°6' W
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to