A
A
Alexey Kos2015-02-25 18:35:36
Perl
Alexey Kos, 2015-02-25 18:35:36

How to write shell command to string type using php?

How to write shell command to string type using php? Tried different ways but nothing worked.

$command = "sudo useradd -m -p $(perl -e 'print crypt($ARGV[0], "123321")' 13321 ) ".$_user_server." && tar -xf /home/files/cs.tar -C /home/".$_user_server."/ && chown ".$_user_server." -Rf /home/".$_user_server." && chmod 777 /home/".$_user_server;

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Yakhnenko, 2015-02-25
@djalexsey

$command = "sudo useradd -m -p $(perl -e 'print crypt($ARGV[0], \"123321\")' 13321 ) ".$_user_server." && tar -xf /home/files/cs.tar -C /home/".$_user_server."/ && chown ".$_user_server." -Rf /home/".$_user_server." && chmod 777 /home/".$_user_server;

M
merinovkv, 2015-02-25
@merinovkv

And isn't it a string? There is a perception that this
can interfere. Replace quotes with single quotes and
escape this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question