Home » Infrastructure » Unix » Simple Shell Script Question
Simple Shell Script Question [message #98067] Fri, 16 January 2004 06:11 Go to next message
KK
Messages: 24
Registered: March 2002
Junior Member
Hi All!

I am modifying the following shell script which displays the incorrect output when executed.

# $7 = Description;

str2=`echo $7&#124cut -c 28-$str_len`

*****Line that is giving error in program

echo "$str2"

The problem I am having is str2 can have different values as stated below: 

str2 = Rope is 7" long  (It is not displaying correctly because of the double quotes in the description after the 7) 

str2 = Current Ass'y Line (This description currently displays correctly)

str2 = Test item (This description currently displays correctly)

Does anyone have any suggestions on allowing the description to be entered and displayed to contain no quotes, single quotes or double quotes?

Thanks in advance for your help!
Re: Simple Shell Script Question [message #98070 is a reply to message #98067] Mon, 19 January 2004 01:45 Go to previous message
Frank Naude
Messages: 4566
Registered: April 1998
Senior Member
Hi,

You can always remove the quotes by doing something like this:

tr -d "'"


Best regards.

Frank
Previous Topic: mounting cdrom problem
Next Topic: Capture a filename from UNIX to insert into a table
Goto Forum:
  


Current Time: Sat Jan 16 12:53:10 CST 2021