Prevent bash from interpretation :


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Prevent bash from interpretation :
# 1  
Old 06-24-2002
Prevent bash from interpretation :

I am using bash shell; my requirement is to run a long command.

Now I have split this long command into a number of shell variables.
Some of these shell variables contain special character ':'

At the end, when the intended long command is executed as a series of small shell variables the ':' is interpreted by the bash shell.

How can I prevent bash from not interpreting ':' ?
# 2  
Old 06-24-2002
Can you tell us what the commands the variables are being used in.....this can have a large bearing on how the character is interpreted by the shell.
# 3  
Old 06-24-2002
export IFS="^"
LibsDir=$YJHOME/LLib
YJLIB=$YJHOME/YjAge/YjAge.jar:$LibsDir/classes12.zip
REQJBLIB=$LibsDir/jdsserver.jar:$LibsDir/beandt.jar:$LibsDir/dx.jar:$LibsDir/sunrsasign.jar
EXTRAJBLIB=$LibsDir/i18n.jar:$LibsDir/javaplugin.jar:$LibsDir/javaplugin_l10n.jar:$LibsDir/rt.jar
JDEVELOPLIB=$LibsDir/jndi.jar:$LibsDir/jta.jar:$LibsDir/nls_charset12.jar:$LibsDir/nls_charset11.jar:$LibsDir/classes111.jar
YJCLASSPATH=$YJLIB:$REQJBLIB:$EXTRAJBLIB:$JDEVELOPLIB:$CLASSPATH
RPOL=-Djava.security.policy=jar:file:$YJHOME/YjAge/YjAge.jar!/rmi.policy
java -classpath $YJCLASSPATH -Djava.security.manager $RPOL com.yj.age.AgeBody &
==========================================
After I have added export IFS="^", in YJCLASSPATH I get an space ' ' between the concatination of variables
# 4  
Old 06-24-2002
Okay. So you have lots of lib locations and you are trying to set these all as variables within your script...so that you can define the YJCLASSPATH for the java command at the end.

What is the error you are getting.....and can you put in some echos after certain points to see what the variables have been assigned with....particularly YJCLASSPATH and RPOL. let me know what you arrive at.
# 5  
Old 06-26-2002
File /tmp/4.sh has below entry
export IFS=^
echo ++++++++++++++++++++++++++++++++++++
export MYJAR="$YJHOME"/Yj/YjAge.jar
export XERCESJAR="$YJHOME"/LinuxLib/sax.jar
export CLASSPATH="$MYJAR":"$XERCESJAR"
echo $CLASSPATH
echo ---------------------------------------

file: 1 has this entry
/tmp/4.sh


Now I exucute using
sh ~/1

YJHOME is set to
/tmp

I get following result:
++++++++++++++++++++++++++++++++++++
/tmp/Yj/YjAge.jar :/tmp/LinuxLib/sax.jar
---------------------------------------

As you can see I get this space between last jar for the first variable value and the begining of the next variable value
# 6  
Old 06-26-2002
Okay...makes sense (your explanation does - the problem doesn't).

Can you add a couple of more echoes...one for
echo $MYJAR
$XERCESJAR

Also I'm assuming you've checked that there is no whitespace at the end of the variable definitions? i.e a space after the last character of this line:
export MYJAR="$YJHOME"/Yj/YjAge.jar

Because it is a variable it's effectively just a string until it is used...so spaces will count and be applied later on.

Using vi - you can use :set list

This will show you any white space at the end of the line before the eol character ($)

Try these things and let me know again.
# 7  
Old 06-26-2002
I think I found the problem

I had edited this original file from windows 2000 machine to Linux machine using default ftp protocol. This comes with IE browser.

Later I had given chmod +x on 4.sh file.

In such a case when i execute file 4, an additional space appears while appending variable values.

Now I have converted this file from dos type to UNIX type using dos2unix utility, this has resulted in making additional space to disappear

I appreciate your effort.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Interpretation of UNIX command

what does the below do. echo * | xargs ls | wc –l echo * - Output a string comprising the name of each file in the working directory, with each name separated by a space. xargs ls - construct argument list command wc -l - it will pipe the output to the wc command, which will... (4 Replies)
Discussion started by: houmingc
4 Replies

2. UNIX for Advanced & Expert Users

Truss output interpretation

hi, anyone can help on this piece of truss output? 8094: 0.7028 write(4, 0x0043BE90, 236) = 236 8094: T S H \0\0\0EC020101\0\0\0\0\0\0\0\0\0 "02\0\0 303\0\0 I D 8094: \f %\0\0\0\0 2\0F67F\0\0\0\0 @06FFC99A ; 8094: L D6\0 303 8094: ... (6 Replies)
Discussion started by: ghostdog74
6 Replies

3. AIX

lspath output interpretation

On my VIo I see the following for my disks: $ lspath | grep hdisk6 Enabled hdisk6 fscsi0 200600a0b82193f7,4000000000000 Enabled hdisk6 fscsi0 200700a0b82193f7,4000000000000 Enabled hdisk6 fscsi2 200600a0b82193f8,4000000000000 Failed hdisk6 fscsi2 200700a0b82193f8,4000000000000 $ lspath |... (8 Replies)
Discussion started by: petervg
8 Replies

4. Shell Programming and Scripting

how do i prevent $ from being commented out if no value is present? (Bash Script)

Hey guys, I want to paste a code in a .php file via a bash script. I am on ubuntu 10.04. The problem is if the values for $ aren't present, then all of them would be removed by the script. An example of my script (I modified it for this thread to prevent it from being overly complicated) ... (2 Replies)
Discussion started by: xxxx
2 Replies

5. Solaris

solaris versions interpretation

Hi What means Solaris 10 5/09 and Solaris 10 10/09, I mean the suffix 5/09 and 10/09 ? thx for help. (1 Reply)
Discussion started by: presul
1 Replies

6. IP Networking

DNS ENUM RR interpretation

Hi Guys, This is really really urgent. Am looking out for some quick answers. I'm developing a DNS Resolver client that interprets DNS Query repsonses & pass on the needful to DNS applications. When an ENUM query(modified to an nslookup naptr query) is issued & an NAPTR RR(Resource Record)... (1 Reply)
Discussion started by: smanu
1 Replies

7. AIX

interpretation of sar

hello with a sar i have this result: System configuration: lcpu=48 ent=4.00 14:06:37 %usr %sys %wio %idle physc %entc 14:06:39 26 9 3 62 1.63 40.7 14:06:41 26 9 3 63 1.58 39.4 14:06:43 ... (0 Replies)
Discussion started by: pascalbout
0 Replies

8. UNIX for Advanced & Expert Users

SAR -b interpretation

I have used SAR -b to get some Unix cache / buffer metrics and the results are confusing me a bit. The pread/s & pwrit/s are showing 0. However the lread/s and lwrit/s are showing figures. I note also that the bread/s and bwrit/s are showing figures. I believe that pread/s and pwrit/s is not... (3 Replies)
Discussion started by: jimthompson
3 Replies

9. UNIX for Dummies Questions & Answers

Interpretation of the uptime command

Hi there, do someone have detailed information how to interpret the uptime command or rather which values can be called normal? (i know what the information means, but i have no idea if these values are ok or to high: 3:02pm an 13:53, 2 Benutzer, Durchschnittslast: 10,06, 12,05, 13,00) ... (5 Replies)
Discussion started by: odin1999
5 Replies

10. UNIX for Dummies Questions & Answers

shell interpretation

I executed the following command in the korn shell: $ variable1="qwerty" ls | sort and the shell executed the 'ls | sort' command. I would have expected an error message from the shell, but instead of that the shell ran the 'ls | sort' command and didn't realize the variable assignement. ... (1 Reply)
Discussion started by: PhilippeCrokaer
1 Replies
Login or Register to Ask a Question