Hi to all. I am learning about the exec command in shell scripts. As an
example, consider this script:
#!/bin/sh
exec > textfile
echo "This is the first line of text"
echo "This is the second line of text"
exit 0
Naturally, this will write the two echoed lines to a file called textfile.
Now, suppose instead that, for whatever reason, I want to write the first
line to a text file and the second to the screen. How to I stop echoing to
the file and resume echoing to the screen? I tried:
#!/bin/sh
exec > textfile
echo "This is the first line of text"
exec > /dev/stdout
echo "This is the second line of text"
exit 0
That failed, of course. Thanks in advance for any suggestions--
Andrew
--------------------
BYU Unix Users Group
http://uug.byu.edu/
The opinions expressed in this message are the responsibility of their
author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG.
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/newbies