- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: ksh ENV variable
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
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
Community
Resources
Forums
Blogs
- 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
04-09-2007 08:33 PM
04-09-2007 08:33 PM
ksh ENV variable
Can I somehow source more than one file in the ENV variable in ksh ?
Usually it's set to $HOME/.kshrc but I'd like to source for example a global /etc/kshrc AND then $HOME/.kshrc
The problem is that I have several users spread over several machines and they all have their own .kshrc. Now I want to add some aliases to their shell, but I don't want to edit every users $HOME/.kshrc
If I set the aliases in /etc/profile they are there as they should in the login shell, but if I change shell, or run a script, they won't be in the new shell that's executed, that's why I think I need to set them in a global kshrc aswell.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2007 08:40 PM
04-09-2007 08:40 PM
Re: ksh ENV variable
No. The best you can do is source a new file then source /etc/kshrc AND then $HOME/.kshrc.
Anyway, why do you have any control over ENV? I reset it in my .profile, why would you expect your users to do anything different?
>that's why I think I need to set them in a global kshrc as well.
That's correct. But if you are offering a service with these aliases, your users should be glad to change their .kshrc files and source your new file.
Of course if these aliases are part of a management stick, I can see why they wouldn't. ;-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2007 10:58 PM
04-09-2007 10:58 PM
Re: ksh ENV variable
Did you check the global function feature of ksh. May be it can be an option for you in this case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2007 03:12 AM
04-10-2007 03:12 AM
Re: ksh ENV variable
it depends on the way, where $ENV is set:
If you do that in /etc/profile, you have won:
Modify the setting to:
ENV=/usr/local/etc/ksh.aliases
export ENV
and at the end of /usr/local/etc/ksh.aliases
add something like:
if alias setglobalaliases 2>/dev/null
then :
elif [ -s ~/.kshrc ]
then . ~/.kshrc
fi
When the above condition is not met, you'll have to do it the other way round:
Add an anchor - similar to the above solution - to every .kshrc (you have to change this for every existing user only once):
if alias setglobalaliases 2>/dev/null
then :
elif [ -s /usr/local/etc/ksh.aliases ]
then . /usr/local/etc/ksh.aliases
fi
In both cases, add into your global aliases-file the anchor-alias and your other stuff:
cat /usr/local/etc/ksh.aliases
alias setglobalaliases=true
alias lspr='lpstat -o$PRINTER'
...
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2007 05:46 PM
04-10-2007 05:46 PM
Re: ksh ENV variable
export ENV='${FILE[(_$-=1)+(_=0)-(_$-!=_${-%%*i*})]}'
This doesn't set aliases for scripts, only interactive shells.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2007 07:16 PM
04-10-2007 07:16 PM
Re: ksh ENV variable
Anyway, I solved my problem without using aliases at all, fiddeling with the PATH variable instead.
Thanks for your help tho.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2007 07:21 PM
04-10-2007 07:21 PM
Re: ksh ENV variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2007 07:34 PM
04-10-2007 07:34 PM
Re: ksh ENV variable
Exactly, if you aren't interactive, you shouldn't be using aliases, etc. It makes your scripts/subshells start faster.