Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Ubuntu This forum is for the discussion of Ubuntu Linux.


  Search this Thread
Old 06-19-2014, 04:42 AM   #1
LQ Newbie
Registered: Jun 2014
Posts: 2

Rep: Reputation: Disabled
Question How to execute main command and sub commands in a single line

I am trying to execute these commands in single line to import a file ...
I used this command as main command ..
sh tomcat/webapps/MyProject/WEB-INF/bin/./myproject console -j
For importing ..
import /home/spadmin/Desktop/XML/testReport.xml

When i am trying to execute like this

sh tomcat/webapps/MyProject/WEB-INF/bin/./myproject console -j;import /home/spadmin/Desktop/XML/testReport.xml

It is taking as 2 different terminal commands and throwing error.
Old 06-19-2014, 01:58 PM   #2
Senior Member
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 3,962
Blog Entries: 10

Rep: Reputation: 1471Reputation: 1471Reputation: 1471Reputation: 1471Reputation: 1471Reputation: 1471Reputation: 1471Reputation: 1471Reputation: 1471Reputation: 1471
Yes. What you wrote will be interpreted as two different commands.

What flow of commands do you normally use to accomplish what you want?

Is it the case that the "myproject console" starts a new console of some type, and the once within that console you type "import /home/spadmin/Desktop/XML/testReport.xml". So the problem is you need to send that import command "to" your console?

I'm thinking that neither PIPE nor input redirect would work here, but instead an argument in invoking that console where it would run a script or command passed to it when it was invoked. If the console doesn't support this, the question becomes one of whether you can modify that console to support that.

What I mean by PIPE would be something like:
ls *.c | grep test
And what that would do is take the directory of all C files and if any happened to have the string "test" in their name, it would then output that subset of C files. And I very much doubt PIPE would work here for you.

Input redirection would be something like:
ls *.c > fl1
grep test < fl1
This would create a list of C files in a file called "fl1" using redirection, and then further use redirection to send the contents of fl1 to the grep command. I doubt this would work either because your console would have to allow command redirection to be sent to it as part of invoking it.

Therefore I think it all comes down to whether or not you can launch that particular console with an argument that means "execute this when the console is opened".
Old 06-25-2014, 05:45 AM   #3
LQ Newbie
Registered: Jun 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled

When i am trying to execute like this

sh tomcat/webapps/MyProject/WEB-INF/bin/./myproject console -j -c import /home/spadmin/Desktop/XML/testReport.xml

it is going into the console and taking the import command as the console command but it resulting No prototype context exist error.

Thanks in advance ..

Last edited by Shravanti; 06-25-2014 at 05:50 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] Bash script to read line by line and execute commands Striketh Programming 4 11-06-2011 11:38 AM
[SOLVED] execute commands after run command Programming 2 01-14-2011 07:22 AM
To install firefox extension in command line, How to make commands execute in order sr71919 Linux - General 2 12-28-2009 05:23 PM
To execute two commands in a single line remotely ZAMO Linux - General 12 10-31-2008 01:31 AM
Using FTP to execute command line commands remotely steve_2010 Solaris / OpenSolaris 4 02-13-2004 08:44 AM

All times are GMT -5. The time now is 03:57 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