[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash question: what is the difference in the following?
> On Sun, Jul 16, 2000 at 11:41:00PM +0300, Shaul Karl wrote:
> > > >
> > > > [08:40:06 /tmp]# DAEMON=powercom
> > > > [08:41:59 /tmp]# ARGUMENTS='-m "Advice Partner/King PR750" -s 00131581
> > > > /dev/ttyS1'
> > > > [08:42:09 /tmp]# echo $DAEMON $ARGUMENTS
> > > > powercom -m "Advice Partner/King PR750" -s 00131581 /dev/ttyS1
>
> > > > [08:42:17 /tmp]# `echo $DAEMON $ARGUMENTS`
>
> > > > Network UPS Tools - PowerCom UPS driver 0.01 (0.44.0-pre4)
> > > > Unable to open (1) Partner/King: No such file or directory
> > > > [08:42:25 /tmp]#
>
> Why not just `$DAEMON $ARGUMENTS` ? This will run $DAEMON with
> $ARGUMENTS as its arguments.
>
> It's the echo command that is messing things up.
>
> Check this out:
>
> I have two directories x and y.
> ls "x y" -> returns an error: ls: x y: no such file or directory
>
> However:
> ls `echo "x y"` ->returns a listing of directory x and directory y
> as if 'ls x y' was written.
>
> Shell quoting can be difficult sometimes... maybe I'm wrong again.
>
> --Nimrod.
No, this one is totally wrong. `$DAEMON $ARGUMENTS` gives the output of my
daemon with its parameters to bash and bash treats the output as a command
line. There for I am getting
[01:12:56 /tmp]# `$DAEMON $ARGUMENTS`
bash: Network: command not found
[01:13:01 /tmp]#
And indeed when my daemon is activated properly its output is
Network UPS Tools - PowerCom UPS driver 0.01 (0.44.0-pre4)
--
-- Shaul Karl <shaulk@israsrv.net.il>
Donate free food to the world's hungry: see http://www.thehungersite.com
=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il