Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 08-24-2016, 08:01 AM   #1
LQ Newbie
Registered: Aug 2016
Posts: 2

Rep: Reputation: Disabled
Rhel7 double quotes not escaping space


I am running java code to execute linux command using:

cmd = "cmd /C %SMBASE%/util/formlib.exe -xf "+"""+file.getLocation().toString()+""";
} else if(System.getProperty("").toLowerCase().startsWith("linux")){
cmd = _SMBASE+"/util/formlib -xf "+"""+file.getLocation().toString()+""";
String outputLocation = root+"/"+path+"/bin";
IProject project = file.getProject();
Process p = Runtime.getRuntime().exec(cmd,null,new File(outputLocation));

when file.getLocation is like /legacy/prod/sample.lib there is no problem with exec.
But when there is path like /legacy/my folder.sample.lib
I am getting error like:
No such folder error: /legacy/my

Why double quotes not not escaping spaces in path?
Old 08-24-2016, 08:15 AM   #2
LQ Guru
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,681

Rep: Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857
how is related to linux? You wanted to run a command on windows and it was not formatted properly.
I would try to check the content of the variable cmd and also find how to protect spaces using Runtime.getRuntime().exec
1 members found this post helpful.
Old 08-24-2016, 08:39 AM   #3
LQ Newbie
Registered: Aug 2016
Posts: 2

Original Poster
Rep: Reputation: Disabled
This is the code deal with linux

cmd = _SMBASE+"/util/formlib -xf "+"""+file.getLocation().toString()+""";
//cmd = /legacy/util/formlib -x /disk/home/rkasiraju/my folder/sample.lib


This editor taking "backslash"" as """
Could you please provide the sample?
Attached Thumbnails
Click image for larger version

Name:	cde.png
Views:	7
Size:	7.6 KB
ID:	22843  

Last edited by rkasiraju; 08-24-2016 at 08:46 AM.


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
[SOLVED] Difference between echo of file within double quotes and without double quotes ankitpandey Programming 2 01-11-2013 09:02 AM
translate value from single quotes to double quotes venkateshrupineni Linux - Newbie 2 06-14-2012 03:03 PM
escaping double quotes in a file koszta5 Linux - Newbie 3 12-12-2010 09:32 PM
Using single quotes vs double quotes in PHP strings vharishankar Programming 6 07-11-2005 11:41 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:43 PM.

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