Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The question is somewhat related to the question asked here,, but the difference is, I need to execute the whole commands whether or not the commands are successful or not. So I presume, && is not an option right? Can I use ; separated commands and eval or bash; something like

eval cd /home/user/homedir ; /home/user/homedir/sbin/ --config /home/user/homedir/etc/dd2 --script /home/user/homedir/sbin/dd3 start action1

or something like that?

Please advise,

share|improve this question
Is /home/user/homedir/sbin/ --config /home/user/homedir/etc/dd2 --script /home/user/homedir/sbin/dd3 start action1 all one command? What can you tell us about what /home/user/homedir/sbin/ does? (Also, why do you want to cd to /home/user/homedir and then use full pathnames?) – Scott Dec 21 '12 at 17:54
up vote 0 down vote accepted

';' works. You could also use '&', simplified like this:

/home/user/homedir/sbin/ --config & /home/user/homedir/etc/dd2 --script & /home/user/homedir/sbin/dd3 start action1

(Simultaneous execution, see comment for clarification below)

share|improve this answer
That would run the two commands simultaneously in separate processes. (1) This doesn't sound like what was asked for. (2) This almost never makes sense when the first command is a cd, because it means that the second command won't get the benefit of the cd; i.e., it will run in whatever directory the user (the shell) is in when the command is typed, and not in /home/user/homedir, as seems to be intended. – Scott Dec 21 '12 at 4:55
For simultaneous execution, then: cd /home/user/homedir; /home/user/homedir/sbin/ --config & cd /home/user/homedir; /home/user/homedir/etc/dd2 --script & cd /home/user/homedir; /home/user/homedir/sbin/dd3 start action1 – Sectio Aurea Dec 21 '12 at 4:59
yup, Scott is correct. As Sectio Aurea pointed out we should use the multiple cd to execute the scripts simultaneously. – Aczire Dec 21 '12 at 5:06
Somebody is confused. The question gives the appearance that ~/sbin/ ––config ~/etc/dd2 ––script ~/sbin/dd3 start action1 is one command. I asked the OP for confirmation and got no indication to the contrary. But the above answer has taken this command and broken it into three parts. This is not an answer to this question, as stated. Neither grep; Scott; /etc/passwd nor grep& Scott& /etc/passwd& will display my user ID information. – Scott Jan 5 '13 at 0:36
You're right technically. It's possible that it's one command but didn't seem at all likely - looking more like a naive use of bash. I answered based on that hunch about the 'real question' and expected the OP to correct me if that wasn't useful. – Sectio Aurea Jan 9 '13 at 0:05

What you have is fine, except I would leave off the eval unless you have some reason for having it (I don't see any reason).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .