Re: coupl'a silly questions (and another)


Subject: Re: coupl'a silly questions (and another)
From: Scott Frankel (papi@flaquito)
Date: Sat Aug 25 2001 - 15:55:50 MDT


OK, being totally new to functions in bash:

Are functions declared starting with the term, "function?" i.e.:
        function new() { ls -lt ${@+"$@"} | head; }

Would the function statement go in my .bashrc file, for example,
sourced on login?

What would cause the following syntax error?
    % function new() { ls -lt ${@+"$@"} | head; }
    % new /etc/
    bash: syntax error near unexpected token `/etc'

Thanks!
Scott

On Saturday 25 August 2001 10:53, Patrick Smith wrote:
> Scott Frankel wrote:
> > Under tcsh: alias new 'ls -lt \!* | head'
> >
> > So ... anyone know the bash magic to pass an argument from the
> > commandline. Seems like this should be so clear; but it's still
> > eluding me. Maybe I *should* change back to tsch ;)
>
> From the section on aliases in the bash man page:
>
> There is no mechanism for using arguments in the replacement
> text. If
> arguments are needed, a shell function should be used (see
> FUNCTIONS
> below).
>
> So write it as a function:
>
> new() { ls -lt ${@+"$@"} | head; }



This archive was generated by hypermail 2a24 : Sat Aug 25 2001 - 15:05:54 MDT