Re: User function in pipe




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

.



Relevant Pages

  • Re: User function in pipe
    ... >> Shell functions access their arguments in the same way that scripts do, ... > echo $| reverse ... > echo $//return does not work, ...
    (comp.unix.shell)
  • Re: User function in pipe
    ... >> Shell functions access their arguments in the same way that scripts do, ... > echo $| reverse ... > echo $//return does not work, ...
    (comp.unix.shell)
  • Re: User function in pipe
    ... > Shell functions access their arguments in the same way that scripts do, ... echo $| reverse ... echo $//return does not work, ...
    (comp.unix.shell)
  • Re: (AIX 5L) (NOT A) MYTH: Shutdown scripts can be placed in /etc/rc.d/rcX.d
    ... or does it reverse and go in descending ...  so I stop the WEBSERVER, then APPSERVER, then LDAP and then ... number the K scripts in the opposite order as the S scripts. ... perhaps you can use its startup and shutdown files as guides... ...
    (comp.unix.aix)
  • RE: [SLE] Changing runlevel priorities
    ... >> Does anyone knows how to change the order of the runlevel scripts? ... The kills generally run in the reverse order of the ... You just need to be aware that there are some dependencies, ... reverse the process if I introduced problems. ...
    (SuSE)