[Ilugc] One Day One Command

  • From: andyetitmoves@xxxxxxxxx (Ramkumar R)
  • Date: Fri Jan 7 09:15:13 2005

But  whas the point?  you could  have pre-defined  'f' anyway  in your
bashrc.

not to forget, much more efficient too...gets defined only once...and
writing lines of shell code in an alias sources it....sourcing is
different from writing a script in many ways....

it moves on...


cheers,

  -Suraj

On Thursday 06 Jan 2005 7:09 pm, Suraj wrote:
T.R.Shashwath wrote:
,----

| ...Including the ability to use a whole function definition in it...
|
| alias something="foo() { echo $bar }

`----

you can 'define'  a function, yes.  But whats your  point?  alias is a
literal expansion.  its very much like a pre-processor operation.

alias foo="function bar() { echo hello world; }"

will only  'define' the function 'bar'  when you type  'foo'. Its just
that instead of  having to type of the entire  function, you typed out
'foo'. and the above example is slightly misleading, in a way, in that
if people try to type 'foo test message', they would get syntax errors
because it does literal expansion.

some examples:

$ alias intemp="cd /tmp; "
$ intemp ls
<output of ls>
$ pwd
/tmp

$ alias obfuscated="function myfunc() {"
$ obfuscated echo hello world; }; myfunc
hello world
$

cheers,

  -Suraj

--
To know a thing well, know its limits.
Only when pushed beyond its tolerances will true nature be seen.
--The Amtal Rule - Dune
---end quoted text---

--
,-----------------[http://www.symonds.net/~suraj/]---o
| Mysore T. Chowdiah is also a composer with the mudra trimakoota (after his
| birth place tirumakoodlu or T.narasipura)
`------------------------------[suraj@xxxxxxxxxxx]---o
_______________________________________________
To unsubscribe, email ilugc-request@xxxxxxxxxxxxx with
"unsubscribe <password> <address>"
in the subject or body of the message.
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc



-- 
If you want to travel around the world and be invited to speak at a lot
of different places, _just_ write a Unix operating system.
                                                       - Linus Torvalds

Other related posts: