in reply to string in system command
The cp command is not getting the parameters you expected. The double-quotes are not needed within back-quotes, unless you want them surrounding the parameters to cp in case of spaces in the directory or file names. In that case you'd need to escape them with backslashes. Use:$DIR='/someDir'; $FILE='someFile'; $DIR2='/someOtherDir'; $out = `echo cp "$DIR/$FILE $DIR2/$FILE" . "_dev1"`; print $out,$/; # # output # cp /someDir/someFile /someOtherDir/someFile . _dev1
The braces around the variable name (the 2nd instance of $FILE) distinguish the variable from the following text.`cp $DIR/$FILE $DIR2/${FILE}_dev1`
|
|---|