On Sunday 20 January 2008 18:41:26 Aaron Kulkis wrote: > Rodney Baker wrote: > > On Sunday 20 January 2008 17:01:41 David C. Rankin wrote: > >> Listmates, > >> > >> After finding some interesting information in the .bashrc tips at > >> http://www.novell.com/coolsolutions/tools/17142.html, I adapted the > >> welcome screen idea to capture useful system information on login. I > >> have to admit, the colors made it pretty cool. (I'm easily amused > >> tonight) > >> [...] > > > > Thanks for sharing this David. I gave it a try on my system at home but > > it threw a syntax error on the following line... > > > >> echo -ne "${lightblue}Uptime for:${green} $HOSTNAME ${lightblue}is > >> ${cyan}";uptime | awk /'up/ {print $3,$4,$5,$6,$7,$8,$9,$10}' > >> } > > > > Not being familiar with awk, I played around a bit but ended up just > > deleting everything from the pipe onwards. > > > > Very useful script though. Thanks again. > > > > Regards, > > Try this: > echo -ne "${lightblue}Uptime for:${green} $HOSTNAME ${lightblue}is\ > ${cyan}";uptime | awk /'up/ {print $3,$4,$5,$6,$7,$8,$9,$10}' > } > > The problem is that the original code spanned more than > one line, and wrapped around.
Aaargh! Thanks, Aaron. Good catch. I never thought about word wrap. It just happened that that was the only line in the script long enough to be affected. > > When you did your cut & paste, the line AS DISPLAYED had > a hidden embedded carriage return, which was not in the > original code. Yep - getting rid of the extra CR did the trick. Your suggestion also worked of course (standard bash line splitting). > > The way to fight that is, when posting code which goes on > for more than one line, put a \as the last character > on the line.... (which effectively turns the carriage > return into a space) > > I noticed similar problems in the code that is on the > suse page referenced by David. The author looks to be > experienced enough to know about the \ trick, so it's > kind of annoying that he posted all the code in the > manner that he did -- it's not like this hasn't been > around since the 1970's. > > > Hope that helps. Definitely. Thanks again. Regards, -- =================================================== Rodney Baker VK5ZTV [EMAIL PROTECTED] =================================================== -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
