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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to append spaces(say 10 spaces) at the end of each line based on the length of th prathima UNIX for Dummies Questions & Answers 17 01-28-2009 04:10 PM
Unix filenames and spaces x96riley3 Shell Programming and Scripting 2 01-31-2007 07:07 PM
VARIABLE HANDLING in UNIX VENC22 UNIX for Dummies Questions & Answers 1 05-28-2005 07:31 AM
File handling in UNIX VENC22 UNIX for Dummies Questions & Answers 4 05-18-2005 03:29 AM
Strip leading and trailing spaces only in a shell variable with embedded spaces jerardfjay Shell Programming and Scripting 6 03-07-2005 02:24 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 11-05-2001
supercbw supercbw is offline
Registered User
  
 

Join Date: Nov 2001
Location: Buffalo
Posts: 7
Question handling spaces in unix

I am testing a ksh script for email. In the script I receive several parameters. One of them is a subject. The subject may contain spaces. Ex. Test this. When I am running the script on telnet to test, how should the syntax at the command line be written. I have this:

ksh ResendE.sh '001111' '000001' 'christest.WDA.001111.000001. 'WDA' '01-NOV-01' '01-NOV-01' 'christest.WDA.001111' "" "" 'this subject' 'destintion'

this command believes the subject is blank. If I use double quotes I get the same results as I did from using single quotes. Can this be accomplished?
  #2 (permalink)  
Old 11-05-2001
rwb1959's Avatar
rwb1959 rwb1959 is offline
Registered User
  
 

Join Date: Aug 2001
Location: Virginia, USA
Posts: 438
It looks like you are passing 11 command line args.
(the 3rd one is missing a quote - typo?)
The "" and "" I assume are "empty" strings you wish to
pass as args 8 and 9?
You should be able to pass arguments containing
spaces in single or double quotes without a problem.


You can add...
set -x
...to your script and actually trace the variable assigments
during execution and hopfully find the error.

If your still having problems, it might help to see the script.
  #3 (permalink)  
Old 11-06-2001
LivinFree's Avatar
LivinFree LivinFree is offline Forum Advisor  
Goober Extraordinaire
  
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
Also, you can add a "\" before each space, for example:

This\ is\ the\ subject

Also, if your shell allows it, you could set the IFS equal to something else, like the ":" character...

YMMV since I did not test this before posting.
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 03:00 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