- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: interesting unix problems
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
09-16-2003 09:58 AM
09-16-2003 09:58 AM
The idea was to open a new ksh with preset aliases and aliases exporting does not work.
2. Does any one have an example of aliases exporting?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 10:09 AM
09-16-2003 10:09 AM
Re: interesting unix problems
Check the following script.
$cat scr
. ./aliases.sh
printf "enter your name:"
read name
echo "This is from interaction - $name"
echo "Below is the alias doit"
doit
$cat aliases.sh
alias doit="echo this is doit"
$./scr
enter your name:test
This is from interaction - test
Below is the alias doit
this is doit
You can define alias in the original script itself if you want.
See if it helps you.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 10:12 AM
09-16-2003 10:12 AM
Re: interesting unix problems
try this thread:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xe88093e260b0d611abdb0090277a778c,00.html
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 10:12 AM
09-16-2003 10:12 AM
Re: interesting unix problems
ie:
/tmp/your_file_with_vars:
alias new=vi
alias ll="ls -al"
Then just after you run the ksh command just source that file. To source a file enter the dot "." then a space then the path to the file:
root> . /tmp/your_file_with_vars
any environment vars setup in that file will stay in the shell until you exit the shell.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 10:19 AM
09-16-2003 10:19 AM
Re: interesting unix problems
that was not aliases exporting.
You defined aliases in the same shell as script scr runs by sourcing aliases file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 10:27 AM
09-16-2003 10:27 AM
Re: interesting unix problems
Look at the man page of ksh
//keywords listed above. Aliases can be created, listed, and exported
with the alias command and can be removed with the unalias command.
Exported aliases remain in effect for subshells but must be
reinitialized for separate invocations of the shell (see Invoking ksh
below).
//
If it is a seperate invocation of the shell, then, you will have to source in the aliases again which was what I did. There are few aliases compiled into ksh itself that are available to all the shells.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 10:46 AM
09-16-2003 10:46 AM
Re: interesting unix problems
Do you have an example that show that alias is effective for a sub-shell without re-initialization? To me if you have to define alias again it was not exported.
It looks like "alias -x" is useless.
John,
I can put aliases in the file no problem, but
how can I execute that file automatically and leave that shell running without going into trouble of installing expect?
Thanks for all your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 10:58 AM
09-16-2003 10:58 AM
Re: interesting unix problems
. /tmp/your_parm_file
on a line by itself in that script.
Maybe I am not understanding what specifically you want to do. Let me know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 10:59 AM
09-16-2003 10:59 AM
Re: interesting unix problems
See if this works.
ENV='${MyFILE[ (_$- = 1) + (_ = 0) - (_$- != _${-%%*i*}) ]}'
MYFILE=~/.kshrc
export ENV MYFILE
Put the above in your .profile and login again. Then the aliases in .kshrc should be available to all your subsequent subshells.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 11:12 AM
09-16-2003 11:12 AM
SolutionLook at the following document for more hints
http://docs.hp.com/hpux/onlinedocs/B2355-90046/B2355-90046.html
Particularly the "Advanced Concepts" where it explains about ENV variable.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 11:20 AM
09-16-2003 11:20 AM
Re: interesting unix problems
I have the following in my .profile
export ENV=$HOME/.kshrc
And the aliases is defined in .kshrc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2003 11:23 AM
09-16-2003 11:23 AM
Re: interesting unix problems
to summarize:
1. export ENV=filename and ksh will execute that file and stay interactive
2. export of aliases does not work but thats ok because ENV in #1 could be dynamic and all aliases could go there.
Thanks!!!