The UNIX and Linux Forums  

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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Find lines with space between strings Galt Shell Programming and Scripting 5 05-07-2008 11:06 AM
Doubt regarding Select() sunil_ktg UNIX for Advanced & Expert Users 2 12-15-2007 04:46 AM
How to concatenate two strings or several strings into one string in B-shell? fontana Shell Programming and Scripting 2 08-26-2005 08:58 AM
swap space / paging space aaronh AIX 2 05-19-2004 07:06 AM
pageing space vs swap space VeroL UNIX for Dummies Questions & Answers 1 01-22-2004 08:54 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-09-2005
Registered User
 

Join Date: Jun 2004
Posts: 146
How to select strings with space?

Hi folks,

I have the following select function:
select_vs_plugin()
{
export VS_LIST=`cat VsList.lst`
while [[ "1" = "1" ]]
do
echo
echo
echo ===================================================================
============
echo Please select Video Server Plugin
echo ===================================================================
============
echo
select selectedVsPlugin in $VS_LIST Quit
do
if [[ -z "${selectedVsPlugin}" ]] ; then
echo "\n**** !! Invalid Option !! ****\n"
else
break
fi
done
if [[ ${selectedVsPlugin} = "Quit" ]] ; then
echo "\n**** End of video servers selection ****\n"
break
else
export SELECTED_VS=${selectedVsPlugin}
echo The select video server plugin is : ${SELECTED_VS}
fi
done
}

The configuration file VsList.lst contains the following video servers names:
MediaBase XMP 7.2
Maestro 4
SeaChange iTV 2.5

The function suppose to display those names in selection menu.
Now,the selection diplaying looks as the following:
===============================================================================
Please select Video Server Plugin
===============================================================================

1) MediaBase
2) XMP
3) 7.2
4) Maestro
5) 4
6) SeaChange
7) iTV
8) 2.5
9) Quit
#?


The wrapped displaying occured due to the space in the names in tthe lst file.

How can i overcome on this space problem?

Thanks in advance.

Nir
Reply With Quote
Forum Sponsor
  #2  
Old 05-09-2005
Registered User
 

Join Date: Feb 2005
Location: Coimbatore, Tamilnadu, India
Posts: 119
Change the IFS variable setting as,

export IFS='
'

It will work.
Reply With Quote
  #3  
Old 05-09-2005
Registered User
 

Join Date: Jun 2004
Posts: 146
Hi muthukumar,

Thanks for your reply!
I didn't understand the meaning of "IFS parameter".
To which parameter did you mean?

Thanks in advance,
Nir
Reply With Quote
  #4  
Old 05-09-2005
Registered User
 

Join Date: Feb 2005
Location: Coimbatore, Tamilnadu, India
Posts: 119
IFS is default shell parameter to give strings patterns based on the field separator. You are doing operation as, export VS_LIST=`cat VsList.lst` so that it will take ' ' <space> as FS so try to change newline to do your work.
Reply With Quote
  #5  
Old 05-09-2005
Registered User
 

Join Date: Jun 2004
Posts: 146
Thanks again muthukumar!

Frankly,i'm looking for a solution that not require a shell parameters changing,because it might harm other functions in the program.

Any other solutions will be greatefully accepted.

Nir
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:55 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0