[asterisk-users] ! Command from -rx?

Tzafrir Cohen tzafrir.cohen at xorcom.com
Sat Aug 4 21:41:27 CDT 2007


On Sat, Aug 04, 2007 at 10:05:34PM -0400, Baji Panchumarti wrote:
>   On 8/4/07, Matt  wrote:
> 
> > This may sound stupid.. so bear with me for a moment.
> >
> > Assuming the only access I have to a machine is through asterisk -rx
> > can I use the ! command?
> >
> > asterisk -rx help
> >
> > includes the ! command, but I can't seem to get it to work ie:
> >
> > asterisk -rx "! ls"
> >
> > Any help?
> 
>     asterisk -rx `! ls > myout.txt`

Huh? Those are backticks. They get translated by the shell (e.g.: bash)
to "the output of the command '! ls > myout.txt'"
It seems that the '!' is interpeded here as a command, rather than as a
part of history substitusion.

See:

  $ echo `!ls`
  bash: !ls`: event not found
  $ echo `! ls`
  bash: echo: command not found

As that specific command's output is redirected to a file, it will be
expanded to:

  asterisk -rx ''

Which is probably not what you wanted.

> 
>  will save the output in myout.txt
> 
>     asterisk -rx "`! ls`"

Here the results will actually be the same, because '! ls' will not
produce any output. But if it did, e.g:

  asterisk -rx "`ls`"

you'd probably notice that asterisk normally doesn't like an arbitrary
list of files as comands.

-- 
               Tzafrir Cohen       
icq#16849755                    jabber:tzafrir at jabber.org
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com       
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir



More information about the asterisk-users mailing list