Re: User function in pipe
- From: "shima" <shima@xxxxx>
- Date: 29 Dec 2005 06:57:06 -0800
Stachu 'Dozzie' K. napisal(a):
> On 29.12.2005, shima <shima@xxxxx> wrote:
> >
> > Barry Margolin napisal(a):
> >
> >> > echo ${text} | reverse | cut -f2- -d '/' | reverse
> >> Shell functions access their arguments in the same way that scripts do,
> >> with variables named $1, $2, etc.
> >
> > Yes, but using
> > echo ${text} | reverse
> >
> > give me empty string.
> > My function is:
> > reverse()
> > {
> > effect= expression_to_do_sth_with ${1}
> > echo ${effect} //return does not work, of course
> > }
> >
> > What is wrong with my function?
>
> It's simple: Your function doesn't contain body.
> Show the whole function, and then we could tell you something about it.
> Otherwise we can just guess.
AYW:
reversed()
{
rever=`echo ${1} | sed '/\n/!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//'`
echo ${rever}
}
I don't think it will help, but ...
BR
Shima
.
- Follow-Ups:
- Re: User function in pipe
- From: Kevin Collins
- Re: User function in pipe
- From: Stachu 'Dozzie' K.
- Re: User function in pipe
- References:
- User function in pipe
- From: shima
- Re: User function in pipe
- From: Barry Margolin
- Re: User function in pipe
- From: shima
- Re: User function in pipe
- From: Stachu 'Dozzie' K.
- User function in pipe
- Prev by Date: Re: move and rename a directory of files on the fly
- Next by Date: Re: User function in pipe
- Previous by thread: Re: User function in pipe
- Next by thread: Re: User function in pipe
- Index(es):
Relevant Pages
|
|