Re: Functions

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

 



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@xxxxxxxxxxxx
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



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux