LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 03-28-2012, 12:18 PM   #16
saeedamer
LQ Newbie
 
Registered: Feb 2011
Posts: 25

Original Poster
Rep: Reputation: 0

Quote:
Originally Posted by instrumentpilot View Post
saeedamer, I'm guessing your DEV12 is an alias. If you type alias on the command line then you should see it printed in the output.

Let us know,
Michael Cunningham
No, DEV12 is a function not an alias. I "$ alias" and DEV12 was not listed.

Code:
$ type DEV12
DEV12 is a function.
$

Last edited by saeedamer; 03-28-2012 at 12:24 PM.
 
Old 03-28-2012, 12:21 PM   #17
saeedamer
LQ Newbie
 
Registered: Feb 2011
Posts: 25

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by colucix View Post
If functions are set in the environment, you should see them using the set command, as suggested by catkin above. In alternative you can try
Code:
type DEV12
If you don't see any relevant output, maybe the code you're looking for hasn't been defined as an environment shell function (please notice that functions must be exported using
Code:
export -f function_name
in order to be available to the users' environment). Which system and shell is this, anyway
AIX 6.1 and ksh.

Code:
$ type DEV12
DEV12 is a function.
$
And see this error please:

Code:
$ export -f home
ksh: export: 0403-010 A specified flag is not valid for this command.
$
Quote:
If functions are set in the environment, you should see them using the set command, as suggested by catkin above.
I do see them but no source code. Here is what I see:

Code:
_=DEV12

Last edited by saeedamer; 03-28-2012 at 12:33 PM.
 
Old 03-28-2012, 01:37 PM   #18
instrumentpilot
Member
 
Registered: May 2006
Posts: 34

Rep: Reputation: 2
saeedamer, just for kicks I did

type declare

It comes back with "declare is a shell builtin".

I am running the /bin/bash shell so maybe you are not seeing the declare feature due to not being in this shell. I'm guessing, but maybe if you try to switch to the bash shell you can do what you are trying with the "declare -f home" command. Just a thought.

Michael Cunningham
 
Old 03-28-2012, 01:58 PM   #19
saeedamer
LQ Newbie
 
Registered: Feb 2011
Posts: 25

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by instrumentpilot View Post
saeedamer, just for kicks I did

type declare

It comes back with "declare is a shell builtin".

I am running the /bin/bash shell so maybe you are not seeing the declare feature due to not being in this shell. I'm guessing, but maybe if you try to switch to the bash shell you can do what you are trying with the "declare -f home" command. Just a thought.

Michael Cunningham
Thanks Michael but I am unable to change the shell. I get this:

Code:
$ cat /etc/shells
/bin/csh
/bin/ksh
/bin/psh
/bin/tsh
/bin/bsh
/usr/bin/csh
/usr/bin/ksh
/usr/bin/psh
/usr/bin/tsh
/usr/bin/bsh
$ . /bin/bsh
ksh: 0403-057 Syntax error: `;' is not expected.
$ . /usr/bin/bsh
ksh: 0403-057 Syntax error: `;' is not expected.
$ bash
ksh: bash:  not found.
$
Besides, I don't need to know the type of DEV12 but its source code.

Thanks
 
Old 03-28-2012, 02:54 PM   #20
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198
What is the value of $FPATH? If it is a list of directories, is there a file called DEV12 in one of them?

If $ENV is set, is the function defined in the file it names?

What happens if you run set -xv and then run DEV12?

Do you see the function being defined if you run ksh -xv ?
 
Old 03-28-2012, 03:09 PM   #21
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
Indeed information on the system and the shell is relevant in this case.
Code:
typeset -f home
should show the code of the home function. Also try
Code:
typeset -f
without arguments. What does it show?

Last edited by colucix; 03-28-2012 at 03:11 PM.
 
Old 03-29-2012, 06:48 AM   #22
saeedamer
LQ Newbie
 
Registered: Feb 2011
Posts: 25

Original Poster
Rep: Reputation: 0
Thumbs up

Quote:
Originally Posted by colucix View Post
Indeed information on the system and the shell is relevant in this case.
Code:
typeset -f home
should show the code of the home function. Also try
Code:
typeset -f
without arguments. What does it show?
"typeset -f home" did the job - Thank you so much!!

Here is what it did (and this is exactly what I was looking for:

Code:
$ typeset -f home
function home
{
export ORACLE_HOME=/su01/app/oracle/product/10.2.0/db_1
echo $ORACLE_HOME
}
$
Thank you (specially) and thanks to everyone who spent time and tried to help me out - thank you everyone!!!
 
Old 03-30-2012, 06:23 AM   #23
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,338

Rep: Reputation: 259Reputation: 259Reputation: 259
Quote:
Originally Posted by saeedamer View Post
Code:
$ cat /etc/shells
/bin/csh
/bin/ksh
/bin/psh
/bin/tsh
/bin/bsh
/usr/bin/csh
/usr/bin/ksh
/usr/bin/psh
/usr/bin/tsh
/usr/bin/bsh
$ . /bin/bsh
ksh: 0403-057 Syntax error: `;' is not expected.
$ . /usr/bin/bsh
ksh: 0403-057 Syntax error: `;' is not expected.
$ bash
ksh: bash:  not found.
$
NB: Although it really looks like bash isnít there: there is the command chsh to change your own login shell and on the AIX system I have access to it lists more than in /etc/shells.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Specify address for a function in Relocatable Code raghu2383 Programming 20 08-05-2008 09:14 PM
function call in kernel code vishalbutte Programming 1 02-15-2006 01:32 PM
source code for read() function ? Mike Davies Linux - Software 1 11-03-2004 02:10 PM
error function in c code shams Programming 3 08-06-2004 04:00 AM
C code for killall function Linh Programming 3 08-01-2003 11:34 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 01:11 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