1834018 Members
2510 Online
110063 Solutions
New Discussion

alias again

 
SOLVED
Go to solution
navin
Super Advisor

alias again

i have setup alias for a command. it works in comand line not script.could u please advice ....what could be the prob
thanks so much
Learning ...
3 REPLIES 3
Torsten.
Acclaimed Contributor
Solution

Re: alias again

the answers still apply:

http://forums12.itrc.hp.com/service/forums/questionanswer.do?threadId=1233036

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
James R. Ferguson
Acclaimed Contributor

Re: alias again

Hi Navin:

As Torsten notes, re-read your original post.

Be sure that you are sourcing (reading; not executing) your script. This works:

# cat ./myalias
#!/usr/bin/sh
alias say='echo'

# . ./myalias
# say hello
hello

Notice the dot; some whitespace; and then the name of the file to be sourced (read). The idea is not to create a new environment.

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: alias again

You should consider not using aliases in scripts. Or if you do, define it in the same file.
I have defined ENV so that my .kshrc file is not available in my scripts, so they run faster.