<div dir="ltr">you guys are so helpful! Thanks.<br></div><div class="gmail_extra"><br clear="all"><div>:-)~MIKE~(-:</div>
<br><br><div class="gmail_quote">On Sun, Aug 24, 2014 at 7:40 PM, Jon Kettenhofen <span dir="ltr"><<a href="mailto:subs@kexsof.com" target="_blank">subs@kexsof.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I like visible proofs, so here's a test I ran:<br>
(terminal output was as is shown)<br>
<br>
[jon@localhost ~]$ rm temp<br>
[jon@localhost ~]$ echo >>temp<br>
[jon@localhost ~]$ echo $?<br>
0<br>
[jon@localhost ~]$ cat temp<br>
<br>
[jon@localhost ~]$ echo >>temp 2>&1<br>
[jon@localhost ~]$ echo $?<br>
0<br>
[jon@localhost ~]$ cat temp<br>
<br>
<br>
[jon@localhost ~]$<br>
<br>
as you can see, no errors and the single ">" did not erase the file when used in this manner. So Mike's script should work as intended<br>
at least if there is no stderr output.<br>
<br>
but suppose there was an error? (apologizing for the length of ...)<br>
<br>
[jon@localhost ~]$ echo "echo" >test<br>
[jon@localhost ~]$ echo "ls temp2" >>test<br>
[jon@localhost ~]$ # test ls of non-existent file<br>
[jon@localhost ~]$ ls temp2<br>
ls: cannot access temp2: No such file or directory<br>
[jon@localhost ~]$ echo $?<br>
2<br>
[jon@localhost ~]$ # see, we get both an error and stderr message<br>
[jon@localhost ~]$ # so<br>
[jon@localhost ~]$ mv test test.sh<br>
[jon@localhost ~]$ chgmod +x test.sh<br>
bash: chgmod: command not found...<br>
[jon@localhost ~]$ chmod +x test.sh<br>
[jon@localhost ~]$ # i'm not perfect!<br>
[jon@localhost ~]$ rm temp<br>
[jon@localhost ~]$ ./test.sh >>temp<br>
ls: cannot access temp2: No such file or directory<br>
[jon@localhost ~]$ echo $?<br>
2<br>
[jon@localhost ~]$ cat temp<br>
<br>
[jon@localhost ~]$ ./test.sh >>temp 2>&1<br>
[jon@localhost ~]$ echo $?<br>
2<br>
[jon@localhost ~]$ cat temp<br>
<br>
<br>
ls: cannot access temp2: No such file or directory<br>
[jon@localhost ~]$<br>
<br>
as you can see, Mike's script will work as he apparently intended,<br>
providing he's using a modern version of bash.<div class=""><br>
<br>
<br>
On 08/24/2014 09:56 PM, James Mcphee wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
you've said make, append stdout (default file descriptor 1) to file<br>
make.fail, assign stderr (default filedescriptor 2) the same<br>
filedescriptor as stdout. So... If the intent was to have both stderr<br>
and stdout append make.fail, then it is correct.<br>
<br>
<br>
On Sun, Aug 24, 2014 at 6:06 PM, Michael Havens <<a href="mailto:bmike1@gmail.com" target="_blank">bmike1@gmail.com</a><br></div><div class="">
<mailto:<a href="mailto:bmike1@gmail.com" target="_blank">bmike1@gmail.com</a>>> wrote:<br>
<br>
what I really need to know is will this:<br>
<br>
make>>make.fail 2>&1<br>
<br>
send stderr and stdout to the file 'make.fail' or did I write it<br>
incorrectly?<br>
<br>
:-)~MIKE~(-:<br>
<br>
<br>
On Sun, Aug 24, 2014 at 2:56 PM, Brian Cluff <<a href="mailto:brian@snaptek.com" target="_blank">brian@snaptek.com</a><br></div><div><div class="h5">
<mailto:<a href="mailto:brian@snaptek.com" target="_blank">brian@snaptek.com</a>>> wrote:<br>
<br>
the > will delete any file that it points at even if the command<br>
doesn't actually output anything. It will even delete the file<br>
is the command doesn't exist like if you type grep as gerp<br>
>file, file will still be created/overwritten.<br>
<br>
If you want to make sure that your command doesn't overwrite any<br>
existing files you have to set the noclobber option like:<br>
$ set -o noclobber<br>
<br>
A good trick to know:<br>
You can use the > to delete the contents of a file without<br>
having to delete and recreate the file by simply doing this:<br>
$ >yourfile<br>
<br>
Brian Cluff<br>
<br>
<br>
On 08/24/2014 02:36 PM, Michael Havens wrote:<br>
<br>
I have a question about redirections:<br>
<br>
make>>make.fail 2>&1<br>
<br>
tells it make and then to send (>) stderr (2) to stdout (1)<br>
and also to<br>
send stdout that way also (&1). finally all of that gets<br>
sent to a file<br>
named make.fail (>>). Isn't '>>' actually 'append' whereas<br>
'>' would<br>
work just as well so long as the file didn't already exist?<br>
If the file<br>
did exist would I get an error or would the file be overwritten?<br>
:-)~MIKE~(-:<br>
<br>
<br></div></div>
------------------------------<u></u>__---------------------<br>
PLUG-discuss mailing list -<br>
PLUG-discuss@lists.phxlinux.__<u></u>org<br>
<mailto:<a href="mailto:PLUG-discuss@lists.phxlinux.org" target="_blank">PLUG-discuss@lists.<u></u>phxlinux.org</a>><div class=""><br>
To subscribe, unsubscribe, or to change your mail settings:<br></div>
<a href="http://lists.phxlinux.org/__mailman/listinfo/plug-discuss" target="_blank">http://lists.phxlinux.org/__<u></u>mailman/listinfo/plug-discuss</a><br>
<<a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank">http://lists.phxlinux.org/<u></u>mailman/listinfo/plug-discuss</a>><br>
<br>
------------------------------<u></u>__---------------------<br>
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.__<u></u>org<br>
<mailto:<a href="mailto:PLUG-discuss@lists.phxlinux.org" target="_blank">PLUG-discuss@lists.<u></u>phxlinux.org</a>><div class=""><br>
To subscribe, unsubscribe, or to change your mail settings:<br></div>
<a href="http://lists.phxlinux.org/__mailman/listinfo/plug-discuss" target="_blank">http://lists.phxlinux.org/__<u></u>mailman/listinfo/plug-discuss</a><div class=""><br>
<<a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank">http://lists.phxlinux.org/<u></u>mailman/listinfo/plug-discuss</a>><br>
<br>
<br>
<br>
------------------------------<u></u>---------------------<br>
PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org" target="_blank">PLUG-discuss@lists.phxlinux.<u></u>org</a><br></div>
<mailto:<a href="mailto:PLUG-discuss@lists.phxlinux.org" target="_blank">PLUG-discuss@lists.<u></u>phxlinux.org</a>><div class=""><br>
To subscribe, unsubscribe, or to change your mail settings:<br>
<a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank">http://lists.phxlinux.org/<u></u>mailman/listinfo/plug-discuss</a><br>
<br>
<br>
<br>
<br>
--<br>
James McPhee<br>
</div><a href="mailto:jmcphe@gmail.com" target="_blank">jmcphe@gmail.com</a> <mailto:<a href="mailto:jmcphe@gmail.com" target="_blank">jmcphe@gmail.com</a>><div class=""><br>
<br>
<br>
------------------------------<u></u>---------------------<br>
PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org" target="_blank">PLUG-discuss@lists.phxlinux.<u></u>org</a><br>
To subscribe, unsubscribe, or to change your mail settings:<br>
<a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank">http://lists.phxlinux.org/<u></u>mailman/listinfo/plug-discuss</a><br>
<br>
</div></blockquote><div class="HOEnZb"><div class="h5">
<br>
------------------------------<u></u>---------------------<br>
PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org" target="_blank">PLUG-discuss@lists.phxlinux.<u></u>org</a><br>
To subscribe, unsubscribe, or to change your mail settings:<br>
<a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank">http://lists.phxlinux.org/<u></u>mailman/listinfo/plug-discuss</a><br>
</div></div></blockquote></div><br></div>