The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
DNS ENUM RR interpretation smanu IP Networking 1 11-03-2007 09:33 AM
interpretation of sar pascalbout AIX 0 03-01-2006 06:24 AM
SAR -b interpretation jimthompson UNIX for Advanced & Expert Users 3 10-26-2005 07:12 AM
Interpretation of the uptime command odin1999 UNIX for Dummies Questions & Answers 5 03-03-2004 07:01 AM
shell interpretation PhilippeCrokaer UNIX for Dummies Questions & Answers 1 06-13-2002 10:06 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-23-2002
Registered User
 

Join Date: Jun 2002
Posts: 5
Stumble this Post!
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 ':' ?
Forum Sponsor
  #2 (permalink)  
Old 06-24-2002
Registered User
 

Join Date: Nov 2001
Location: New Zealand
Posts: 333
Stumble this Post!
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.
__________________
Pete
  #3 (permalink)  
Old 06-24-2002
Registered User
 

Join Date: Jun 2002
Posts: 5
Stumble this Post!
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 (permalink)  
Old 06-24-2002
Registered User
 

Join Date: Nov 2001
Location: New Zealand
Posts: 333
Stumble this Post!
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.
__________________
Pete
  #5 (permalink)  
Old 06-25-2002
Registered User
 

Join Date: Jun 2002
Posts: 5
Stumble this Post!
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 (permalink)  
Old 06-25-2002
Registered User
 

Join Date: Nov 2001
Location: New Zealand
Posts: 333
Stumble this Post!
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.
__________________
Pete
  #7 (permalink)  
Old 06-25-2002
Registered User
 

Join Date: Jun 2002
Posts: 5
Stumble this Post!
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.
Google The UNIX and Linux Forums
Closed Thread

Tags
linux

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:49 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0