Mailinglist Archive: opensuse (3373 mails)
| < Previous | Next > |
Re: [opensuse] A useful and fun .bashrc welcome screen
- From: Aaron Kulkis <akulkis00@xxxxxxxxxx>
- Date: Sun, 20 Jan 2008 03:11:26 -0500
- Message-id: <4793022E.6040503@xxxxxxxxxx>
Rodney Baker wrote:
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.
When you did your cut & paste, the line AS DISPLAYED had
a hidden embedded carriage return, which was not in the
original code.
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.
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
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.
When you did your cut & paste, the line AS DISPLAYED had
a hidden embedded carriage return, which was not in the
original code.
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.
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
| < Previous | Next > |