Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Is it possible to execute some command in qx argument

by bart (Canon)
on May 10, 2017 at 10:42 UTC ( #1189986=note: print w/replies, xml ) Need Help??


in reply to Re^2: Is it possible to execute some command in qx argument
in thread Is it possible to execute some command in qx argument

$arg = "$(mkdir otherdir1)";
Use single quotes in Perl, or the "$(" won't stick. And do something that produces output as well, to use in the name of the new directory.
$arg = '$(mkdir otherdir1; date +%F_%H.%M.%S)';
This also shows the need to cleanup (AKA "untaint") the user entered input data before just executing it. You could be executing a lot more than you bargained for.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1189986]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2020-05-28 08:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (165 votes). Check out past polls.

    Notices?