Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I want to run some alias command in bash's non-interactive mode. But seems Ubuntu ignore BAHS_ENV. How can I make it work? la is a alias command. And I tested in other linux. it is work fine. Just Ubuntu not work.

BASH_ENV=~/.profile bash -O expand_aliases -c la

share|improve this question

1 Answer 1

up vote 2 down vote accepted

just found out because the origin .bashrc provided by Ubuntu have some code like below to prevent the script run in non-interactive mode. so why my alias not work. It's work now just need to move aliases higher then this block

#If not running interactively, don't do anything
case $- in
 ;; *)
share|improve this answer
any idea why they put it there? –  Aquarius Power Jul 4 '13 at 2:32
you mean why they put the block there? I also dont know :)~ –  Payne Chu Jul 11 '13 at 7:29

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.