Home » Infrastructure » Unix » whats wrong with this?
whats wrong with this? [message #212945] Mon, 08 January 2007 21:40 Go to next message
verkiles
Messages: 15
Registered: November 2006
Location: Philippines
Junior Member

I had a problem with this shell script:

code:

MOD="`echo $i|cut -c 10-11`"

if [ $MOD = 11 ]
then
statement 1...
fi

sample parameter is: i = 01020700.11

this script runs well in the command prompt.
but when i call this script in oracle forms statement 1 doesn't perform.

whats wrong with this one.

Thanks a lot!

[Updated on: Tue, 09 January 2007 01:13]

Report message to a moderator

Re: whats wrong with this? [message #213762 is a reply to message #212945] Fri, 12 January 2007 04:07 Go to previous messageGo to next message
Frank Naude
Messages: 4502
Registered: April 1998
Senior Member
What shell are you using? Can you please post a small test case?
Re: whats wrong with this? [message #214124 is a reply to message #212945] Mon, 15 January 2007 01:32 Go to previous messageGo to next message
verkiles
Messages: 15
Registered: November 2006
Location: Philippines
Junior Member

korn shell.

It doesn't get any value in this script:
MOD="`echo "01020700.11"|cut -c 10-11`"

I try to get the value of MOD using ( echo $MOD > test.txt )
but nothing is written on the test text file thats why statement 1 doesn't execute.

[Updated on: Mon, 15 January 2007 01:55]

Report message to a moderator

Re: whats wrong with this? [message #214176 is a reply to message #214124] Mon, 15 January 2007 04:59 Go to previous messageGo to next message
rleishman
Messages: 3724
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Get rid of the double-quotes:

MOD=`echo $i|cut -c 10-11`


Ross Leishman
Re: whats wrong with this? [message #214184 is a reply to message #212945] Mon, 15 January 2007 05:53 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

You could also

if [ "`echo "01020700.11"|cut -c 10-11`" = 11 ]; then
echo test
fi
Re: whats wrong with this? [message #214321 is a reply to message #212945] Mon, 15 January 2007 18:02 Go to previous message
verkiles
Messages: 15
Registered: November 2006
Location: Philippines
Junior Member

Thanks a lot guys!..

All your ideas work when i run the script in command prompt but when i call the script in oracle forms using host function it doesn't work. I think the problem now in on the form side or something. Anyway i already solved my problem by trying other way.

Regards,
verkiles
Previous Topic: parallel_max_servers parameter
Next Topic: Configuration for sending mails.
Goto Forum:
  


Current Time: Sat Dec 03 16:27:54 CST 2016

Total time taken to generate the page: 0.04491 seconds