Hi Ralph

On 12/03/15 15:34, Ralph Corderoy wrote:
Hi Tim,

I'd like to run multiple commands in Bash:

patch -m <patchfile && hg diff && cd dir && make -s

but for audit purposes I'd like each command in the list to be echoed
as run, even better I'd like the Bash prompt to appear too in front of
each line.

     $ cat tim
     id
     date
     false
     echo not reached
     $
     $ PS1='$ ' bash --norc -ei <tim
  A  $ id
     uid=1000(ralph) gid=1000(ralph) 
groups=1000(ralph),4(adm),20(dialout),24(cdrom),30(dip),46(plugdev),100(users),111(lpadmin),119(admin),122(sambashare)
     $ date
     2015-03-12 15:32:23 +0000 Thu
  B  $ false
     $

Note, the `$ ' from A to B are from the bash I've explicitly invoked.
At the end, it returns to my shell.  Ask if there's anything you can't
figure out.


Perfect. -i gives interactive shell so get prompts. -e exits on error.

Cheers

Tim





--
Next meeting:  Bournemouth, Tuesday, 2015-04-07 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue     / TO THE LIST OR THE AUTHOR

Reply via email to