[Asterisk-Users] echo system command and set the results to a new
variable
Tzafrir Cohen
tzafrir at cohens.org.il
Mon Aug 29 17:59:25 MST 2005
On Mon, Aug 29, 2005 at 06:39:47PM -0400, Henry Junior wrote:
> I am looking to issue a 'System cmd' that will echo the results into
> a new variable -- can anyone tell me the correct way to do this?
>
> example: at the terminal I am currently able to issue this command:
> echo | date > date.txt
Do you want to run that command in the shell? This pipes the output of
'echo' (with no parameters: just prints a single newline) to date (with
no params, ignores its input anyway) and redirects the output of date
into date.txt .
> I end up with a file called date.txt with the contents: Mon Aug 29
> 18:32:45 EDT 2005
As expected.
>
> I would like to issue a command in my dialplan that puts the date
> into a new variable something like this:
> System(echo | date > Set(newVariableName=theDateEchoReturns)
System doesn't do that . chan_backticks does:
http://pbxfreeware.com/app_backticks.c
But then again, I figure that there's a simpler way.
>
> So that the newVariableName=Mon Aug 29 18:32:45 EDT 2005
>
> The objective in this case is to format the date according to the
> Unix Time format listed above. I am certainly open to other options
> for doing this. The default ${TIMESTAMP} format doesn't work for my
> needs.
What do you need it for?
--
Tzafrir Cohen | tzafrir at jbr.cohens.org.il | VIM is
http://tzafrir.org.il | | a Mutt's
tzafrir at cohens.org.il | | best
ICQ# 16849755 | | friend
More information about the asterisk-users
mailing list