- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: alias
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
Discussions
Discussions
Discussions
Forums
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
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
тАО05-19-2008 01:43 PM
тАО05-19-2008 01:43 PM
alias
I have to set up an alias for the command ,user has sh as login shell and few times he changes to bash and then execute the command which i'm trying to setup alias.
But it is not stable .Means it works if i do su - user. But for user it works until the session closes.Please let me know how can i make this as permanent for the user as well as system wide so that the alias will be there permanently
thanks much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-19-2008 04:41 PM
тАО05-19-2008 04:41 PM
Re: alias
The exported environment variables are inherited from the parent shell, so they are not a problem - but the aliases will be gone.
Read the "INVOCATION" chapter in the man page of your bash shell to understand the process.
To get your alias to work, you must define it so that both login and non-login shells will read the definition. That may mean setting it in two places: /etc/profile (for login shells, both sh and bash) and /etc/bash.bashrc (for non-login bash).
If your /etc/bash.bashrc is fully POSIX sh compatible (=contains no bash-specific extensions), you might avoid duplication by defining the aliases in /etc/bash.bashrc only and making /etc/profile read that file by adding this to /etc/profile:
. /etc/bash.bashrc
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-20-2008 01:55 AM
тАО05-20-2008 01:55 AM
Re: alias
For bash shell for the user, you have to put alias commands in .bashrc in the home dir of the user.
vi /home/user/.bashrc
alias ll='ls -l'
Rgds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-20-2008 02:06 AM
тАО05-20-2008 02:06 AM
Re: alias
It might be easier to use a script in another PATH for that command.
You can also use functions that are found in FPATH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-20-2008 06:42 AM
тАО05-20-2008 06:42 AM
Re: alias
I would create a seperate file containing aliases and source that from the different places needed, e.g. use
/etc/aliases.local
and then in /etc/profile, and so on:
...
# include aliases
[ -s /etc/aliases.local ] && . /etc/aliases.local
...
mfG Peter