In a bash script I would like to execute multiple commands while keeping a file locked with setlock. Setlock however only supports the following usage:
setlock [-NnXx] [lock file] [command]
Is there a way to wrap multiple commands together besides using a separated script?
You can use
sh
as a command, enabling you to use&&
,;
or||
as usual to chain multiple commands as desired inside single quotes.For example to run
command1
followed bycommand2
(if the first exits without errors):