note 116609 added to function.system
| From: | TomKaminski | Date: | Thu, 29 Jan 2015 05:42:31 +0000 |
| Subject: | note 116609 added to function.system | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-201547@lists.php.net to get a copy of this message | ||
Seems like php doesn't recognize the -e command line switch for system command
"echo":
<?php
system('echo -e hello');
?>
returns "-e hello", but you'd expect "hello". Odd thing is that you
don't need to specify -e as it by default enables the interpretation of backslash escapes:
<?php
system('echo \'hello\nthere\' ');
?>
returns:
hello
there
but running the same command from the bash shell:
# echo 'hello\nthere'
returns:
hello\nthere
My guess is that php does some special checks to see if echo is being executed by the system and
automatically adds the -e switch.
----
Server IP: 72.52.91.14
Probable Submitter: 24.79.17.162
----
Manual Page -- http://php.net/manual/en/function.system.php
Edit -- https://master.php.net/note/edit/116609
Del: integrated -- https://master.php.net/note/delete/116609/integrated
Del: useless -- https://master.php.net/note/delete/116609/useless
Del: bad code -- https://master.php.net/note/delete/116609/bad+code
Del: spam -- https://master.php.net/note/delete/116609/spam
Del: non-english -- https://master.php.net/note/delete/116609/non-english
Del: in docs -- https://master.php.net/note/delete/116609/in+docs
Del: other reasons-- https://master.php.net/note/delete/116609
Reject -- https://master.php.net/note/reject/116609
Search -- https://master.php.net/manage/user-notes.php