I am using System() command to execute shell command from perl script but I need to run multiple commands one after another. How can we do that in one line.
What I am doing currently is :
$cmd = "ls -l cd /home/xyz ls -l" ,
System($cmd)
I am sure that single command works fine , Can someone let me know if this is right way to do? if not what is wrong here?
You need to do the same thing that you would in your shell. For your test command, it would look something like:
Or better yet, as suggested by BadFileMagic:
This way, the second
lsis not executed if thecdfails.