- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how to add more alias to ksh
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
10-24-2001 01:42 PM
10-24-2001 01:42 PM
He only gets those complied alias as command "alias" shows. Is that possible to set more alias before the user runs "ksh" and take effect afterwards?
Note: the settings in $HOME/.profile or /etc/profile doesn't work, for it is a problem after login-shell is executed.
Thanks in advance.
Lorne
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2001 01:48 PM
10-24-2001 01:48 PM
Re: how to add more alias to ksh
You can set additional aliases through alias command.
For eg: at command prompt:
alias X="ls"
alias Y="who"
Next time, you type X it
will run ls command ;
and Y will run who command.
You can include this alias
settings in your .profile
file, such that they are
set already when you login
to the account.
To display your aliases,
run alias command.
HTH
raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2001 01:50 PM
10-24-2001 01:50 PM
Re: how to add more alias to ksh
You could source (read) a file containing alias commands after the login. Would that help?
#!/usr/bin/ksh
alias show=/usr/bin/echo
Assuming the above file was named $HOME/alias, then after logging in, do:
# . ./alias
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2001 01:52 PM
10-24-2001 01:52 PM
Re: how to add more alias to ksh
Hope this answers your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2001 02:12 PM
10-24-2001 02:12 PM
Re: how to add more alias to ksh
To use ksh is an option in a menu to normal users after they logged in, who are not supposed to have any knowledge of unix. Therefore I have to set everything before they use that.
The point is that I cannot find a way to set alias to ksh before users run it or to let it read a file containing alias settings when it is called.
Thanks again.
Lorne
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2001 03:22 PM
10-24-2001 03:22 PM
Re: how to add more alias to ksh
Then you need to set it in your /etc/profile file.
I think adding this should work. Even you can keep your if statements only for a list of users.
if [ $SHELL = "/usr/bin/ksh" ]
then
alias elles="ls"
alias hoo="who"
fi
So this is applicable to all users that have /usr/bin/ksh as their shell.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2001 03:41 PM
10-24-2001 03:41 PM
Re: how to add more alias to ksh
I understood your problem. My above will not work. Please ignore it.
It may not be possible to do it because when you run /usr/bin/ksh, it is going to spawn a seperate shell that will not have information about the previous aliases. Whatever the aliases we get through alias command are precompiled into the shell.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2001 12:47 AM
10-25-2001 12:47 AM
Re: how to add more alias to ksh
Use exec() to call ksh. In the man page of ksh, it says that you can make ksh to read the /etc/profile and the ${HOME:-.}/.profile, if the first character of arg0 of exec is -.
E.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2001 07:34 AM
10-25-2001 07:34 AM
Re: how to add more alias to ksh
Your idea sounds great, however I am not able to implement that. Have you tried it out?
I have tried some ways but still no idea about where to put "-" between "exec" and "ksh".
Sincerely, thanks to all the HP-UX experts who have given me ideas and helped me there.
Lorne Shu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2001 07:36 AM
10-25-2001 07:36 AM
Solutionexport ENV before the shell is started and point it to a shell-script containing the wanted alias commands.
Like:
export ENV=/usr/lbin/ksh-aliases
...
ksh
And in "/usr/lbin/ksh-aliases" you would have all your "alias this=that" statements...
HTH,
Wodisch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2001 08:02 AM
10-25-2001 08:02 AM
Re: how to add more alias to ksh
Thank you very much for the help! That's exact
the right answer. I wish I could help others just like what you did to me:)
Have a good day.
Lorne Shu