<div dir="ltr">Well, I know no one will really care but me but I have to share!<div><br></div><div>I decided to follow the TLDP manual/workbook to learn BASH. I came to this decision for a couple of reasons: the first being that it is likely the most authoritative and the second was they have exercises whereas the IBM pages didn't. </div><div><br></div><div>Well, I read the first chapter and got to the exercises. The project was to write a script that would print the date and time, who is logged in, and what the uptime of the system is; the I am supposed to ake all of that and print it to a file.</div><div><br></div><div>I thought to myself, "But they haven't taught us anything!" I was about to write to the user group I am part of and ask my infamous "how do I" question when I stopped, took a breath, and figured I should at least try to work it out on my own. So I figured the first line is a pound sign and exclamation point but I was unsure of the order; was it !# or #!. So it just so happens that this sequence of characters is called a sha-bang so the exclamation point must come second. I'll try that first.</div><div>Then I burned some brain cells trying to figure how to run multiple commands and print it all to a single file. I tried encapsulating everything with curly brackets ({ }) but that gave an error of some sort. Finally, after a couple of minutes, it came to me that they probably want their readers to use a favorite search engine (duckduckgo in my case). So after entering the parameters of the search some hits came up and after looking through a few I found one that fit my question. How could I not have realized how to do this? It is merely using the append file redirection (>>)!  So this is what I wrote:</div><div><br></div><div><div>#! /bin/bash</div><div>    date >><file>&<br></div><div>    who >><file>&  </div><div>    uptime>><file> </div><div>done  </div></div><div><br></div><div>Luckily I realized that for there to be a 'done' there also needs to be 'do'. There is no 'do' therefore we don't need the 'done'.</div><div>So I ran the program and everything seemed to run without error, however, did it write the data to a file? I then go back to the terminal and type 'more <file>'. Look at that! Everything is there.</div><div><br></div><div><div>Thu Mar  5 20:44:36 MST 2015</div><div> 20:44:36 up 9 days,  1:45,  2 users,  load average: 0.52, 0.55, 0.73</div><div>bmike1   tty8         2015-02-24 19:00 (:0)</div><div>bmike1   pts/2        2015-03-05 20:22 (:0.0)</div><div><br></div><div><div class="gmail_signature">:-)~MIKE~(-:</div></div>
</div></div>