Real easy questions. Please answer

2009-09-24 Thread eatsubway

sry i have a stupid question.

I have a variable and need to know how many items are in it.

for example:
variable="abc xyz foo"
what program can i call to print out 3

right now im doing this...

Counter()
{
echo $#
}
Counter $IDs
but that just seems stupid
-- 
View this message in context: 
http://www.nabble.com/Real-easy-questions.-Please-answer-tp25606372p25606372.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.





string format

2009-09-23 Thread eatsubway

hello, i have a simple question.  I have a string which i would like to
format by replacing spaces with newlines and tabs, and also adding a tab to
the beginning.

the variable...
MyVar="Hello, how are you doing today?"
I would like to print this

   Hello,
   how
   are
   you
   doing
   today?
-- 
View this message in context: 
http://www.nabble.com/string-format-tp25531252p25531252.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.