Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've discovered the following useful trick for long-running tasks on the command line:

do_some_task && make_a_noise

For instance, on OSX:

do_some_task && say 'done'

However, && means "run the next command if the previous one returned 0 for success". If the first command fails, the second doesn't execute.

Is there a similar operator that means "do this regardless of the previous command's return status"?

share|improve this question

1 Answer 1

up vote 18 down vote accepted

Yes, the ;:

do_some_task ; say 'done'
share|improve this answer
1  
Oh! Hahaha. Yes, that. Thanks. :) –  Nathan Long Jul 11 '12 at 15:58
2  
or if you want more baroque style: do_some_task && say 'done' || say 'done' :) –  lynxlynxlynx Jul 11 '12 at 17:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.