Re: Escaping BASH quotes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you ... that did the trick ...

Have a nice day

Danny

On Feb 02 16, shiplu :
> To: Danny <mynixmail@xxxxxxxxx>, php-general@xxxxxxxxxxxxx
> Date: Tue, 02 Feb 2016 16:08:52 +0000
> From: shiplu <shiplu.net@xxxxxxxxx>
> Subject: Re:  Escaping BASH quotes
> 
> -e in echo means evaluate the following string. PHP double quotes evaluates by
> default.
> 
> So for line, echo -e "\rMYCOMMAND\r" > /dev/ttyS1 you'd write
> 
> file_put_contents("/dev/ttyS1", "\rMYCOMMAND\r");
> 
> I am using file_put_contents as it opens the fie, write content and closes it
> which is exactly what "echo" is doing in your command.
> 
> 
> On Tue, Feb 2, 2016 at 10:04 PM Danny <mynixmail@xxxxxxxxx> wrote:
> 
>     Yes I have ... ;) ... The problem I am experiencing is that the "-e"
>     following
>     the echo command is also sent to /dev/ttyS1 ...
> 
>     On Feb 02 16, shiplu :
>     > To: Danny <mynixmail@xxxxxxxxx>, php-general General List
>     >  <php-general@xxxxxxxxxxxxx>
>     > Date: Tue, 02 Feb 2016 15:57:35 +0000
>     > From: shiplu <shiplu.net@xxxxxxxxx>
>     > Subject: Re:  Escaping BASH quotes
>     >
>     > Did you try opening that device file directly with php's built-in fopen
>     and
>     > write those strings with fwrite?
>     >
>     > On Tue, 2 Feb 2016 9:09 pm Danny <mynixmail@xxxxxxxxx> wrote:
>     >
>     >     Hi guys,
>     >
>     >     I need to send a command to BASH with quotes ... I have tried
>     escapeshelarg
>     >     ()
>     >     and escapeshellcmd ... but somewhere I still have a bug:
>     >
>          here are the BASH commands I need to escape:
>          echo -e "\rMYCOMMAND\r" > /dev/ttyS1
>          echo -e ":AB7ASD-02:Command Msg:VF3LPO" > /dev/ttyS1
>          echo -e "\r\03\r" > /dev/ttyS1
>     >
>     >     At the moment I am using exec() to send these lines ...
>     >
>     >     Any pointers?
>     >
>     >     Thank you
>     >
>     >     Danny
>     >
>     >     --
>     >     PHP General Mailing List (http://www.php.net/)
>     >     To unsubscribe, visit: http://www.php.net/unsub.php
>     >
>     >
> 
>     --
>     PHP General Mailing List (http://www.php.net/)
>     To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux