Re: referring to arguments in bash aliases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Timothy Stone <citylists@xxxxxxxxxxxxxx> writes:

> I've got this far:
>
> llm() { }
>
> It's a start right? ;) Am I headed down the right path? Did I read to
> much between the lines in the man pages for bash? Nothing on the web
> dives this far into aliases in bash. Much seems to skip arguments in
> the alias' replacement text.

I think functions side step some problems aliases have.  I seem to
remember aliases not living thru some situations where functions are
still available.  But didn't try to reproduce.

You may have hit a problem I hit long ago when I started using bash
functions. 

syntax should be:

  name () { some.cmd; }

All ingredients are important... The space after and before {}
The semi-colon after `some.cmd'

They can be fairly elaborate if you watch the syntax.  Here is my most
elaborate one in current use:

enlp () { if [ -z "$1" -o "$1" = help ];then
              echo "Usage: \`enlp [args]  FNAME'"
              echo "Current args are:"
              echo "   enscript -f AvantGarde-Book10/12 -F Times-Roman@14/16 \\"
              echo "    --margins=60::: --word-wrap -G "
          else
enscript -f AvantGarde-Book10/12 -F Times-Roman@14/16 --margins=60::: --word-wra
p -G "$@"
       enscript -f AvantGarde-Book10/12 -F Times-Roman@14/16 --word-wrap $1
          fi; }

Functions can be sourced same as other env stuff.

   . .functions.file


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux