Advertisement

03.10.2005 at 05:40AM PST, ID: 21345320
[x]
Attachment Details

Bash and enviorment variables

Asked by da99rmd in Linux Programming

Tags: enviorment, bash, variable


Hi i have a script that reads a file and parses the file like this:

!set NISSE=.
!set KALLE=%NISSE%\hejsan\dejsan

%NISSE%\lisa.txt
%KALLE%\jesper.txt

The thing i want the script to do is run it and check if all the files exists like this:
pars the !set to be set as env variables

and then run "ls" on the files to se if they exist.

The problem here is the env variables dont get set they get set as
NISSE="."
KALLE="\$NISSE/hejsan/dejsan
The shell escapes the $ i have tried in every whay to escape the escape....?!? if you know what i mean.

The script looks like this at the moment:
MakeEnv () {
`egrep '^!set -f' $file |  sed -e 's|!set -f \(.*=\)\([^ ]\+\)|export \1"\2"|g' | sed 's|\%\([A-Z_]\+\)\%|$\1|g' | sed 's|\\\\|/|g'`
}

im confused ;)

/R
Start Free Trial
[+][-]03.10.2005 at 07:27AM PST, ID: 13506921

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.10.2005 at 08:22AM PST, ID: 13507647

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.10.2005 at 08:35AM PST, ID: 13507832

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.11.2005 at 01:02AM PST, ID: 13514779

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.11.2005 at 04:13AM PST, ID: 13516026

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Linux Programming
Tags: enviorment, bash, variable
Sign Up Now!
Solution Provided By: ahoffmann
Participating Experts: 2
Solution Grade: A
 
 
[+][-]03.11.2005 at 04:55AM PST, ID: 13516322

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32