Functions

Rodolfo Alcazar rodolfo.alcazar at padep.org.bo
Tue Mar 14 13:39:41 UTC 2006


On Mon, 2006-03-13 at 19:38 -0600, hbrhodes wrote:
> why is it that it only works in the format
> 
> function rar()
> {
> /path/to/rar/rar $@
> }
> 
> and not function rar() { /path/to/rar/rar $@ }

[rodolfoap] /home/rodolfoap > function talk(){ echo line; }
[rodolfoap] /home/rodolfoap > set
...
talk ()
{
    echo line
}
> ???
> 
> also, if you don't mind, why is it that you used a $@ instead of a ;

if you call the function with a command like "rar one two three", inside
the function $@ is replaced with "one two three". The ";" sign is a bash
command separator, like the carriage-return does. try this:

[rodolfoap] /home/rodolfoap > function talk(){ echo $@; echo goodbye; }
[rodolfoap] /home/rodolfoap > talk one two three
one two three
goodbye
[rodolfoap] /home/rodolfoap > set
...
talk ()
{
    echo $@;
    echo goodbye
}
--
Rodolfo Alcazar - rodolfo.alcazar at padep.org.bo
Netzmanager Padep, GTZ
591-70656800, -22417628, LA PAZ, BOLIVIA
http://otbits.blogspot.com
--
To invent, you need a good imagination and a pile of junk.
Thomas Edison





More information about the fedora-list mailing list