LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Closed Thread
  Search this Thread
Old 03-14-2008, 06:37 PM   #1
linux_linux
Member
 
Registered: Mar 2008
Posts: 52

Rep: Reputation: 15
Linux Shell Command - Issue


I am facing an issue in linux. when running a shell script file with parameter to java file i.e whenever i encounter single quotes , it is getting truncated .

GSS_CMD_AI.sh is a Shell script file

Shell Command:
sh GSS_CMD_AI.sh -sql "insert into test values(1,'Robert','s')"

Content of shell script file:
java -jar AI/$AI/java/$AI.jar $1 \'"$2"\'


Result in java file : insert into test values(1,Robert ,s)
Expected Result in java file: insert into test values(1,'Robert ','s')

Please help me resolve this Urgent issue in Shell command !
 
Old 03-14-2008, 09:34 PM   #2
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
hmm... I'll venture a guess:

the double quotes are working on the command line, but get stripped when being sent to the shell script, so when the shell gets the argument, it's a single argument, but sans the double quotes & only has single quotes... which it then treats as containers & ships them off to the java app, stripped of the single quotes.

maybe something like:

sh GSS_CMD_AI.sh -sql "\"insert into test values(1,'Robert','s')\""

that's a total guess, but I'd imagine that the solution will have some sort of escaped quotes - single and/or double.
 
Old 03-15-2008, 03:13 PM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
not a networking question. moved to Linux - Newbie
 
Old 03-15-2008, 08:53 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Sick of bot posting problems from a different forum verbatim on LQ
in irrelevant boards. Banning the thing and closing the threads.
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unix vs. Linux shell command Chong Programming 10 01-12-2007 08:41 AM
Call Linux Shell Command from within *.c program in userspace? pat_and_cami SUSE / openSUSE 1 03-08-2006 02:39 AM
shell command to shutdown linux OS alix123 Programming 3 08-22-2005 08:17 AM
Linux shell command questions BabaKali Linux - Newbie 4 11-09-2004 08:03 PM
How to call the arp linux shell command from within a perl program Bassam Programming 1 03-11-2004 02:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration