Not sure where this thread originated but positional
parameters work in aliases, you just need to escape
the '$':
$ alias hello="echo got \$1"
$ hello abc
got abc


--- Mike Vanecek <[EMAIL PROTECTED]> wrote:
> OK, no positional parameters in an alias; sorta
> thought that since it would
> not work.
> 
> 
> ---------- Original Message -----------
> From: "Todd A. Jacobs" <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Sent: Fri, 10 Jan 2003 18:41:30 -0800 (PST)
> Subject: Re: Passing args
> 
> > On Fri, 10 Jan 2003, Mike Vanecek wrote:
> > 
> > > I want to be in a terminal and type ed filename
> and have the editor open and 
> > > start editing filename in the background.
> > 
> > You can't use positional parameters in an alias;
> you need to use a 
> > function instead:
> > 
> >     # ed is a real program, so use something else
> to avoid confusion.
> >     # Usage: ged <file1 ... fileN>
> >     function ged {
> >     while [[ $1 ]]; do
> >         gedit $1 &
> >         shift
> >     done
> >     }
> > 
> > Put this in your .bashrc file, and either source
> it or log back in to
> > enable the function.
> 
> No luck here either. 
> 
> [root@www root]# cat .bashrc
> # .bashrc
> 
> # User specific aliases and functions
> 
> alias rm='rm -i'
> alias cp='cp -i'
> alias mv='mv -i'
> 
> # Source global definitions
> if [ -f /etc/bashrc ]; then
>         . /etc/bashrc
> fi
> 
> # Usage ged <file1 ... fileN>
> function ged {
>   while [[ $1 ]]; do
>     gedit $1  &
>     shift
>   done
> }
> 
> [root@www root]# ./.bashrc
> Profile executed
> Profile executed
> 
> [root@www root]# set
> BASH=/bin/bash
> ....
> _=./.bashrc
> i=/etc/profile.d/which-2.sh
> langfile=/root/.i18n
> ged ()
> {
>     while [[$1]]; do
>         gedit $1 & shift;
>     done
> }
> 
> [root@www root]# ged dummy.txt
> bash: [[dummy.txt]]: command not found
> 
> 
> As before, I have studied the script, tried all
> possible combinations except
> the correct one, and have decided to end my 18 hour
> day and go to bed. Maybe
> the morning will shed new light.
> 
> Thanks.
> 
> 
> 
> -- 
> redhat-list mailing list
> unsubscribe
>
mailto:[EMAIL PROTECTED]?subject=unsubscribe
>
https://listman.redhat.com/mailman/listinfo/redhat-list


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to