The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
Two or more white spaces in string
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
Two or more white spaces in string
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
2
(
permalink
)
10-04-2006
vino
Supporter (in vino veritas)
Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
I think the default IFS is defined to be a whitespace. So you can change the IFS to a newline and then output the desired variable
Code:
first=HAI second=HELLO oldifs="$IFS" IFS=' ' third="$first $second" echo $third IFS="$oldifs"
Not tested tho'.
vino
View Public Profile
Find all posts by vino
Find vino's past nominations received
Find vino's present nominations given