The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Preventing whitespace to be a delimiter in a for loop (bash/sh) kkkoehne Shell Programming and Scripting 4 05-15-2009 10:20 AM
echo seems to trim whitespace joeyg Shell Programming and Scripting 2 02-28-2008 04:41 PM
Delete whitespace truck7758 Shell Programming and Scripting 12 12-05-2007 12:00 PM
sed : remove whitespace b.hamilton Shell Programming and Scripting 3 11-06-2007 11:02 AM
trim whitespace? msteudel Shell Programming and Scripting 4 07-07-2005 07:57 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-11-2008
lev_lafayette lev_lafayette is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 15
Of bash and whitespace...

Hmmm... Bash doesn't parse whitespace with a read.

Code:
lev@sys09:~$ read line; echo "$line"
 test
test
You can imagine what this does if you're using a shell script to read a list of unknown file names containing unknown spaces.

Code:
lev@sys09:~$ read word1 word2; echo "$word1,$word2"
123 456 789
123,456 789
Anyone have a solution for this?
  #2 (permalink)  
Old 04-11-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Change the value of $IFS temporarily.
  #3 (permalink)  
Old 04-13-2008
lev_lafayette lev_lafayette is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 15
Quote:
Originally Posted by era View Post
Change the value of $IFS temporarily.
Thank you. That worked perfectly. I owe you a beer.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:46 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0