![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Change the IFS variable setting as,
export IFS=' ' It will work. |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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.
|
|
#5
|
|||
|
|||
|
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 |
|||
| Google The UNIX and Linux Forums |