[Ilugc] One Day One Command

  • From: suraj@xxxxxxxxxxx (Suraj)
  • Date: Fri Jan 7 00:39:48 2005

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

-- 
,-----------------[http://www.symonds.net/~suraj/]---o
| 'Oththu Nadaswaram' is very much similar to a 'sruthi box'. It is a simple 
open
| ended pipe set to a fixed frequency. It is used to tune Nagaswarams. It is
| one of the oldest 'pitch reference' instruments.
`------------------------------[suraj@xxxxxxxxxxx]---o

Other related posts: