Operating System - HP-UX
1745814
Members
3824
Online
108722
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2011 07:34 AM
тАО06-10-2011 07:34 AM
ksh bug?
I have a ksh script issue where it appears that /usr/bin/ksh ignores an alias, and searches for it elsewhere (namely FPATH).
The script in question makes use of some aliases that are created by a dotted in script. These are aliases used by dozens of Oracle-related scripts, and they work elsewhere, all the time (or we would be down hard!).
I've put "alias | grep" before and after the alias reference, and it displays the alias accurately, but in execution it can't find it (and sets ${?} to 1). Stderr shows that that the alias was not found.
If I replace the alias call with the actual script name, it works just fine. But - I don't want to do that because it defeats the purpose of the aliases - which is to enable us to alter Oracle environments using one script.
The script also calls some functions that are accessed via "typeset -fu ...." and "typeset FPATH="...". When I create a function with the same name as the alias, it finds it, and executes it as a function.
PHCO-38559 is installed.
Is this a bug? What's the expected behavior? I can't find a definitive reference as to the search order for aliases, functions, etc.
The script in question makes use of some aliases that are created by a dotted in script. These are aliases used by dozens of Oracle-related scripts, and they work elsewhere, all the time (or we would be down hard!).
I've put "alias | grep
If I replace the alias call with the actual script name, it works just fine. But - I don't want to do that because it defeats the purpose of the aliases - which is to enable us to alter Oracle environments using one script.
The script also calls some functions that are accessed via "typeset -fu ...." and "typeset FPATH="...". When I create a function with the same name as the alias, it finds it, and executes it as a function.
PHCO-38559 is installed.
Is this a bug? What's the expected behavior? I can't find a definitive reference as to the search order for aliases, functions, etc.
The people are the hardest part.
- Tags:
- ksh
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2011 08:31 AM
тАО06-10-2011 08:31 AM
Re: ksh bug?
Hi:
Did the script in question suddenly stop working on the server on which you have the problem or is this the first time running it there?
A sample of code that demonstrates the problem would be very nice to see.
That said, the search order should be:
1. keywords
2. aliases
3. shell builtins
4. functions
5. external programs found via the PATH variable
Regards!
...JRF...
Did the script in question suddenly stop working on the server on which you have the problem or is this the first time running it there?
A sample of code that demonstrates the problem would be very nice to see.
That said, the search order should be:
1. keywords
2. aliases
3. shell builtins
4. functions
5. external programs found via the PATH variable
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2011 09:45 PM
тАО06-10-2011 09:45 PM
Re: ksh bug?
>I've put "alias | grep " before and after the alias reference,
Have you tried "whence -v"?
If you quote the first char of an alias, it isn't one.
Have you tried "whence -v
If you quote the first char of an alias, it isn't one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2011 01:23 AM
тАО06-11-2011 01:23 AM
Re: ksh bug?
how do you execute your script?
It just means that your default definition file was not sourced ( . file )
where are the alias defined? in what file?
.profile? .kshrc?
does the .profile defined the ENV variable?
Depending on how you exectute your script those files are not sourced,
- to check that you can at a echo in your .profile/.kshrc, to see if they are sourced.
then if you need them you can either:
explicitely source them in your script for instance.
. /somewhere/mydefaultdefinitions
or test if a variable is defined before sourcing
if [ -z "${MYVARIABLE}" ]
then
. /somewhere/mydefaultdefinitions
fi
It just means that your default definition file was not sourced ( . file )
where are the alias defined? in what file?
.profile? .kshrc?
does the .profile defined the ENV variable?
Depending on how you exectute your script those files are not sourced,
- to check that you can at a echo in your .profile/.kshrc, to see if they are sourced.
then if you need them you can either:
explicitely source them in your script for instance.
. /somewhere/mydefaultdefinitions
or test if a variable is defined before sourcing
if [ -z "${MYVARIABLE}" ]
then
. /somewhere/mydefaultdefinitions
fi
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP