LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-06-2009, 07:58 AM   #1
jaideepca
LQ Newbie
 
Registered: Nov 2009
Posts: 4

Rep: Reputation: 0
“basename $0” returns basename: -k: unknown option


Hi,

I am setting oracle Environment in one of my server(RHEL5). Below is the error i am getting. I am using kshell.

Th=$" (basename $0) "--------returns
basename: -k: unknown option
basename: -s: unknown option
basename: -h: unknown option

Can any one help me to sort above problem.

Thank you
Jaidhe
 
Old 11-06-2009, 08:06 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Try
Code:
echo "DEBUG \$0: '$0'"
before the call to basename to see if $0 has the value you think it has.

There should be no space between $ and ( in $(<some command(s)>)
 
Old 11-06-2009, 08:12 AM   #3
jaideepca
LQ Newbie
 
Registered: Nov 2009
Posts: 4

Original Poster
Rep: Reputation: 0
error

Same script and command working fine on RHEL4, but i am getting error in RHEL5.

Thank You!
 
Old 11-06-2009, 08:23 AM   #4
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
@jaideepca: please listen to senior members. If you're not here to take advice, then you're not in the right place.
I think catkin is on the right track: what is $0 set to? In other words, what is the name of your script?
 
Old 11-09-2009, 03:45 AM   #5
jaideepca
LQ Newbie
 
Registered: Nov 2009
Posts: 4

Original Poster
Rep: Reputation: 0
echo $'DEBUG $0: \'-ksh\''

After setting up DEBUG, getting below error.

+ echo $'DEBUG $0: \'-ksh\''
DEBUG $0: '-ksh'
+ basename -ksh
-ksh: basename: -k: unknown option
-ksh: basename: -s: unknown option
-ksh: basename: -h: unknown option
Usage: basename [ options ] string [suffix]

Thanks!
 
Old 11-09-2009, 04:26 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
OK, so $0 contains -ksh. Your script shows you expected it to be a file name. How does $0 get its value? What is the name of your script and how are you calling it?
 
Old 11-09-2009, 05:30 AM   #7
jaideepca
LQ Newbie
 
Registered: Nov 2009
Posts: 4

Original Poster
Rep: Reputation: 0
basename $0

Thanks catkin,

Below is the format

. /u01/oracle/env -t test

I am using RHEL 5 and using SHELL as kshell.

echo $SHELL
/usr/bin/ksh
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use php basename hil4d Linux - Server 1 04-25-2008 10:11 AM
How to get the 'basename' (or what other.?) command to do what I want..? craftybytes Programming 1 02-13-2008 06:27 AM
basename ovince Programming 2 03-21-2007 09:47 AM
basename counterpart? glass Linux - General 1 08-24-2002 06:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration