- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Alias In Shell Script
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
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
08-16-2002 02:27 AM
08-16-2002 02:27 AM
Can i user defined aliases in shell script.
When used it gives "not found"
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2002 02:42 AM
08-16-2002 02:42 AM
Re: Alias In Shell Script
/usr/bin/alias
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2002 02:46 AM
08-16-2002 02:46 AM
Re: Alias In Shell Script
I tested it, for some reason it did not work.
A simple workaround.
In the beginning of your script:
. $HOME/.kshrc
The "." in the beginning of the line is important.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2002 02:50 AM
08-16-2002 02:50 AM
Re: Alias In Shell Script
Note there is a space between the "." and the rest of the line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2002 03:07 AM
08-16-2002 03:07 AM
Re: Alias In Shell Script
Still No success.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2002 03:10 AM
08-16-2002 03:10 AM
Re: Alias In Shell Script
Have you got a copy/snippet of the script?
Rgds, Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2002 03:13 AM
08-16-2002 03:13 AM
Re: Alias In Shell Script
Have you tried my "workaround". I have tested it and it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2002 03:17 AM
08-16-2002 03:17 AM
Re: Alias In Shell Script
.kshrc
=======
alias frm="export ORACLE_HOME=/d2k/app/oracle7.2 PATH=$PATH:/d2k/app/oracle7.2/b
in TWO_TASK=FRS"
alias nfrm="export ORACLE_HOME=/data1/app/oracle/product/8.0.4 PATH=$PATH:/data
1/app/oracle/product/8.0.4/bin; unset TWO_TASK"
t.sh
=====
frm # defined alias
echo "$TWO_TASK"
nofrm #Defined alias
echo "$TWO_TASK"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2002 03:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2002 03:24 AM
08-16-2002 03:24 AM
Re: Alias In Shell Script
#!/usr/bin/ksh
This way it takes the .kshrc.
Regards,
Ceesjan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2002 03:37 AM
08-16-2002 03:37 AM
Re: Alias In Shell Script
Thanks to all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2002 03:47 AM
08-16-2002 03:47 AM
Re: Alias In Shell Script
When calling up your script, invoke it in the current shell like so:
. t.sh
hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2002 11:57 AM
08-18-2002 11:57 AM
Re: Alias In Shell Script
When defining alias in .kshrc, use the -x option (= exported alias).
Example:
alias -x dir=ls
Now the alias should work in scripts witout reading the .kshrc file in the script (the line:
. $HOME/.kshrc
is not necessary).