Julien Vehent on 31 Aug 2011 09:14:54 -0700 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [PLUG] Bash I/O redirection |
On Wed, 31 Aug 2011 11:48:28 -0400, Matt Mossholder wrote:
Julian, You could try putting blocks of commands inside of parens, which runs them in a subshell, and then just after the parens, put in your
redirect.
Example: #!/bin/bash ( echo "Hi Julien!" cat /etc/hosts echo "Bye Julien!" ) 1> /tmp/myoutput 2>&1 That will take all the stdout and stderr and stuff it into /tmp/myoutput. --Matt
That might have worked, but I have a switch case somewhere in the code, and the parenthesis from the case conflicts with the parenthesis from the block.
# create a command block to redirect the output ( # backup case "$MODE" in FULL) $RMANBIN target / nocatalog << EOF BACKUP INCREMENTAL LEVEL 0 CUMULATIVE DATABASE TAG 'FULL-$(date +%A)'; EOF ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug