bash - How to run a shell command with a sub shell with PHP's exec? -


running command php's exec gives me syntax errors, no matter if run directly or put in file , run that.

time (convert -layers merge input1.png $(for in directory/*; echo -ne $i" "; done) output.png) 

i think problem creates sub shells, exec doesn't seem able handle.

syntax error: word unexpected (expecting ")") 

try simplify command: remove outer () dont need.

you replace $(for in directory/*; echo -ne $i" "; done) directory/* or if worried empty dirs $(shopt -s nullglob; echo directory/*)

time convert -layers merge input1.png directory/* output.png 

or

time convert -layers merge input1.png $(shopt -s nullglob; echo  directory/*) output.png 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -