0

In .xinitrc, there'll have multiple lines with & to put some commands in background, I'd like to control if a command is completed or not before process to next command.

I use zsh in .xinitrc file, not sh.

How we can achive this?

1 Answer 1

1

Using & puts a job in the background and causes execution to continue to the next line. If you want to wait to see whether a command is completed or not, remove the &.

From:

command1 &
command2 &
command3

To:

command1
command2
command3

If you want subsequent commands to execute only if the previous command(s) were successful, then chain them together with &&:

command1 &&
command2 &&
command3

You must log in to answer this question.

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