wish to use shell variable in xml file, is it possible?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting wish to use shell variable in xml file, is it possible?
# 1  
Old 06-11-2012
wish to use shell variable in xml file, is it possible?

greetings,

i have an executable that reads its config from an xml file. this executable needs to be started as the current user. there is a line in the xml file that contains the following:

Code:
<option name="USER_ID" value="myuserid"/>

the current value is an actual user id (mine) as it was populated when i configured the executable with a supplied gui. what i'd like to do is put $USER there instead. is something like this possible?

joe.
# 2  
Old 06-11-2012
Why do you need to do this?

Whoever starts the executable is, by definition, the current user.
# 3  
Old 06-11-2012
On the surface you will need to run something like sed from a Shell script which has visibility of the value of $USER and edit the master XML and produce the version customised for the current user. It doesn't sound like it needs to be dynamic and could be a one-off bulk proliferation of custom XML.

The task could equally be achieved from multiple high-level computer programming languages.

We know nothing about your "executable", your Operating System, your Shell(s). Anything further would be a random guess.
# 4  
Old 06-11-2012
for the benefit of clarification, i have a bunch of execution nodes that are running rhel 5.4 and the sftwr is a cfd solver. the executable/daemon needs to be running when the solver kicks off as this executable manages the mysqld processes, one for each core/cpu. sort of a quasi mpi scenario. the config file that is parsed by the executable/daemon requires a valid user id as omitting it generates an error. the executable/daemon also needs to be running as the user running the solver. the head node of the cluster launches a wrapper script for the solver on behalf of the user on the execution node(s). this sftwr was clearly not designed to do this but in our environment it's up to me to find a 'one shoe fits all' way of doing it. i may very well move the original config files aside and link them to files with open permissions and go with methyl's suggestion. as always, thanx for chiming in! joe.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to pull multiple XML tags from the same XML file in Shell.?

I'm searching for the names of a TV show in the XML file I've attached at the end of this post. What I'm trying to do now is pull out/list the data from each of the <SeriesName> tags throughout the document. Currently, I'm only able to get data the first instance of that XML field using the... (9 Replies)
Discussion started by: hungryd
9 Replies

2. UNIX for Dummies Questions & Answers

Reading XML file and print the values in the text file using Linux shell script

hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file <sequence> <Filename>aldorzum.doc</Filename> <DivisionCode>US</DivisionCode> <ContentType>Template</ContentType> <ProductCode>VIMZIM</ProductCode> </sequence>... (1 Reply)
Discussion started by: sravanreddy
1 Replies

3. Shell Programming and Scripting

Insert value of env variable in xml file

Hello, I have the following variables set in my env echo $MY_XSD_FILE /home/jak/sample.xsd echo $MY_INTERVAL_VALUE 4 I want to insert them between the xml tags in my xml file cat sample.xml ::::::::::::::: ::::::::::::::: <property name="FILE"></property> :::::::::::::::::::::::... (2 Replies)
Discussion started by: jakSun8
2 Replies

4. Shell Programming and Scripting

How to parse xml file in variable-string?

In the wake of the post: how-parse-following-xml-file Thank you for the very useful chakrapani response 302355585-post4 ! A close question. How to pass a file to xmllint in variable? For example, let it be: NEARLY_FILE='<?xml version="1.0" encoding="iso-8859-1"?><html><set label="09/07/29"... (0 Replies)
Discussion started by: OleM2k
0 Replies

5. Shell Programming and Scripting

Trying to pull a variable out of an xml file...

Hello. I'm new to *ix and am trying to pull a variable or two from an xml document. The document is in the format: <name>7_3(A).mov</name> <description>Some description from a file</description> <updatename>7_3_A.mov</updatename> <updatepath>Dailies Released</updatepath> ... (3 Replies)
Discussion started by: Renfield
3 Replies

6. Shell Programming and Scripting

parsing data from xml file is failing can't open variable

Created a korn shell script, everything is is working except this section, the variable $SYSINFO is being set, but the NASIP & NASDEV are failing, it appears to be treating the config.xml file config directory and xml as the file. Need a second set of eyes to tell me where I am messing up. #... (3 Replies)
Discussion started by: juanb25
3 Replies

7. Programming

Accessing environmet variable in xml file

Hi I have certain environmenet variables defined in .profile: export DBNAME="mydb" export DBHOST="devbox.us.abc.com" export DBPORT="1111" export PASSWORD="mypwd" export MMUSER="myid" I also have an xml file defined like: <CONFIG> <DEFAULTS operator="oraread"> <PROPERTY... (2 Replies)
Discussion started by: neeto
2 Replies

8. Shell Programming and Scripting

How to remove xml namespace from xml file using shell script?

I have an xml file: <AutoData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Table1> <Data1 10 </Data1> <Data2 20 </Data2> <Data3 40 </Data3> <Table1> </AutoData> and I have to remove the portion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" only. I tried using sed... (10 Replies)
Discussion started by: Gary1978
10 Replies

9. Shell Programming and Scripting

Plz Help To convert xml file to text file using bourn shell scripts

If someone out there could help me out with this problem. I would really appreciate it. I am trying to convert xml into text file(fixed length) using Unix Borne shell scripts. My xml file: <root> <header_rec recordtype="00"> <record_id>00</record_id> <country_code>AK></country_code>... (0 Replies)
Discussion started by: ram2s2001
0 Replies
Login or Register to Ask a Question