3
votes

I want to string together some shell commands with && -- for instance,

wget -c http://repository/file.tar.gz && tar -xzvf file.tar.gz && rm file.tar.gz

Normally I would use start-process, but this function seems to be confused by the &&. I can just run the three commands in sequence, but in this case as in many others, I want to ensure that the first command was not aborted in error before the second command executes, and so on.

Python's subprocess.call function has a shell=True argument by which you can just send the whole line -- is there such a function in emacs lisp, or in this case I should look for another workaround?

1
you can test with simpler commands, echo 1 && echo 2 && echo 3. I would try escaping the '&'s like \&\&. Good luck. - shellter
I think the problem is that && and ; are not recognized as arguments to the process being called... - hatmatrix
m0skit0: if you are suggesting using ; instead of && then that's no good, because they are semantically different. When you use && you ensure that each command in the sequence is executed only if all of the previous ones succeeded. YMMV, but I know that I only very rarely want ;, and you most certainly wouldn't want to use ; in the example from this question. - phils

1 Answers

2
votes

You probably want to use shell-command.