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 - 23:11:13 MDT


Great! Thanks for the info.
Scott

p.s. "% ^new^foo" works! I must've been clobbering the
name space.

On Saturday 25 August 2001 09:24, Patrick Smith wrote:
> > OK, being totally new to functions in bash:
> >
> > Are functions declared starting with the term, "function?" i.e.:
> > function new() { ls -lt ${@+"$@"} | head; }
>
> Yes, although the word "function" is optional.
>
> > Would the function statement go in my .bashrc file, for example,
> > sourced on login?
>
> If you want to always have the function available at the command line,
> you should put it in both .bashrc and .bash_login. (Or do as I do, and
> make .bash_login a symbolic link to .bashrc.)
>
> > What would cause the following syntax error?
> > % function new() { ls -lt ${@+"$@"} | head; }
> > % new /etc/
> > bash: syntax error near unexpected token `/etc'
>
> I'm not sure. It works for me:
>
> % function new() { ls -lt ${@+"$@"} | head; }
> % new /etc/
> total 2068
> -rw-r--r-- 1 root root 67 Aug 25 11:35 issue
> -rw-r--r-- 1 root root 0 Aug 25 11:35 issue.net
> -rw------- 1 root root 60 Aug 25 11:35 ioctl.save
> -rw-r--r-- 1 root root 152 Aug 25 11:35 mtab
> -rw-r--r-- 1 root root 334 Aug 14 16:38 crontab
> drwxr-xr-x 2 root root 4096 Aug 14 16:37 cron.daily
> drwxr-xr-x 2 root root 4096 Aug 14 16:37 cron.hourly
> drwxrwxr-x 2 news news 4096 Aug 14 16:37 news
> -rw-r--r-- 1 root root 552 Aug 11 21:55 yaboot.conf
>
> Maybe you still have your old alias for new in effect? If so, that
> would override the function.



This archive was generated by hypermail 2a24 : Sun Aug 26 2001 - 01:39:47 MDT