Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some global aliases defined in my ~/.profile file. To read them from a bash script, I'd use:

shopt -s expand_aliases
source ~/.profile

However, in ksh this does not work because it does not have a shopt command. How do I read the aliases from a file in ksh?

share|improve this question
Do you need to do something special in ksh? It seems, the alias are expanded in non-interactive shells, too. – mpy Jan 4 '14 at 12:22
Yes, I'm using ksh because I have a for loop in the script and I need to call variables from that loop, bash does not support this. – shrx Jan 4 '14 at 14:25
Uh, sorry, that was a missunderstanding. I did a quick test with a #!/bin/ksh script, therein sourced an alias file and used an alias with no problem. So my question was, do you need a shopt equivalent after all? Or: What does not work? – mpy Jan 4 '14 at 17:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.