LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-27-2014, 03:13 AM   #1
VM deep
LQ Newbie
 
Registered: Jun 2014
Posts: 3

Rep: Reputation: Disabled
Can't Import XML file into my project console through the terminal


Hi all,
I am trying to import an XML file into my project console via linux terminal. For that I have to execute two commands which are...
1)sh /home/spadmin/..../project console
(it is a terminal command, which is to launch my project console and wait for the console command as input)
2)import /home/spadmin/.../test.xml
(import the test file into my application through the console, it is not a terminal command, it is a console command)

However these two are working well if we execute them one by one like first one to launch the console and then give the second command with in that console to import xml file.

But if I want to execute them as a single command like "sh /home/spadmin/..../project console -c import /home/spadmin/.../test.xml" it is throwing the exception as "illegal state exception: No prototype context exists". I am in a situation to execute them like a single command like above mentioned. Please suggest me the solution. Ask me if you have any clarification regarding this scenario..
Thank you.

Last edited by VM deep; 06-27-2014 at 06:30 AM.
 
Old 06-29-2014, 09:57 AM   #2
Andy Alt
Member
 
Registered: Jun 2004
Location: Minnesota, USA
Distribution: Slackware64-stable, Manjaro, Debian64 stable
Posts: 528

Rep: Reputation: 167Reputation: 167
How about using a script?

Code:
#!/bin/sh
sh /home/spadmin/..../project console
import /home/spadmin/.../test.xml
 
Old 06-30-2014, 02:47 AM   #3
VM deep
LQ Newbie
 
Registered: Jun 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Andy Alkaline View Post
How about using a script?

Code:
#!/bin/sh
sh /home/spadmin/..../project console
import /home/spadmin/.../test.xml
Hi Andy,
I have already tried the script like that, but when we execute the first command the console will open, that's fine but the second command also be treated as a terminal command but not as console command, it won't execute with in the console resulted by the first command. That's the problem. Every line is treated as a separate terminal command which is not the requirement.

Any way, Thanks for ur response
 
Old 06-30-2014, 07:34 PM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
i'm not 100% sure what you want, but maybe
Code:
sh -c 'command1 --options ; command2 --options'
would do the trick?
 
Old 06-30-2014, 08:18 PM   #5
Andy Alt
Member
 
Registered: Jun 2004
Location: Minnesota, USA
Distribution: Slackware64-stable, Manjaro, Debian64 stable
Posts: 528

Rep: Reputation: 167Reputation: 167
Quote:
import an XML file into my project console
I think it might help to know more about the program you're using. Is it an open source project that has a home page?
 
Old 07-01-2014, 12:37 AM   #6
VM deep
LQ Newbie
 
Registered: Jun 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
Hi Andy, ondoho

Thanks for ur responses, finally got the solution for my requirement. Here is it.

Quote:
echo "import /home/spadmin/.../test.xml" | sh /home/spadmin/..../project console

Last edited by VM deep; 07-01-2014 at 12:39 AM.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
using XML::Twig and DBI for storing a xml-file into a myql-db sayhello_to_the_world Programming 3 05-26-2014 10:54 AM
how to add xml-stylesheet tag in a XML File using libxml2 ? peacemission Programming 6 05-26-2012 02:20 AM
[SOLVED] redirect system console to a virtual terminal or a file but after boot process agambier Linux - Kernel 1 03-08-2011 03:24 AM
dropline gnome-terminal error: couldnt get a file descriptor referring to the console Randux Slackware 5 12-05-2006 01:55 PM
how to import XML or HTML file into mediawiki file?? apzc2529 Linux - Server 0 11-10-2006 06:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:23 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
Open Source Consulting | Domain Registration