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
"too big" and "not enough memory" errors in shell script jerardfjay AIX 11 03-16-2009 11:09 PM
simple shell - how to get a parameter typed in a shell script cmitulescu Shell Programming and Scripting 4 01-09-2009 08:45 PM
how to find the path of a file when it is passed as ....filename(parameter) to script yahoo! Shell Programming and Scripting 3 07-24-2008 09:01 AM
checking parameter values passed to script ammu UNIX for Dummies Questions & Answers 2 10-05-2007 01:35 PM
manipulate a passed in parameter rudoraj Shell Programming and Scripting 2 06-11-2007 02:04 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 03-31-2009
raghu.amilineni
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Detecting Doublequotes(") When passed as parameter to shell script

Hi,

I am executing a shell script which takes a string as a parameter.
The scipt should validate the string and create the directoy with the name of specfied string.

The following is the specified command and its parameter.

test.sh "abc abc"

The shell script is not able to identify that the parameter "abc abc" as a single parameter. It takes the input as 2 parameters as it cannot identify the quotes (") specified.

Please suggest me how can I identify that qoutes have been specified as the input parameter.

So, if I am able to identity the quotes in the input parameter then I will throw an error in the cases where input "abc abc" or similar is given.

Thanks in advance
Raghu
  #2 (permalink)  
Old 03-31-2009
c_d c_d is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 45
let it take as 2 parameters...

in the shell script

do this..

str= `echo "$1 $2"`
  #3 (permalink)  
Old 03-31-2009
c_d c_d is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 45
double post

Last edited by c_d; 03-31-2009 at 02:25 PM.. Reason: double post
  #4 (permalink)  
Old 03-31-2009
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Question Not sure if I understand

See the following, where it appears the shell is taking everything inside quotes as one parameter.


Code:
> cat file8.sh
echo $#
echo $*
echo "1="$1
echo "2="$2

> file8.sh a b
2
a b
1=a
2=b

> file8.sh "a b"
1
a b
1=a b
2=

  #5 (permalink)  
Old 04-01-2009
raghu.amilineni
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Thanks for the reply ,

But I dont want to throw error if user specified " as part of the argument.
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 05:48 AM.


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