LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   alias not working after su? (https://www.linuxquestions.org/questions/linux-newbie-8/alias-not-working-after-su-4175577851/)

galtolq 04-19-2016 01:56 PM

alias not working after su?
 
Why doesn't alias work after I su to root?

$ alias foo='echo bar'
$ foo
bar

$ su
Password:

# alias foo='echo bar'
# foo
foo: Command not found.

suicidaleggroll 04-19-2016 01:59 PM

Works fine on my system. What distro and shell are you using ("echo $0" before and after the su)?

Habitual 04-19-2016 02:30 PM

Good on Ubuntu 14 series also.

galtolq 04-19-2016 04:28 PM

The root shell is c-shell. Not bash.
Thanks for helping me figure this out!

alias foo 'echo bar'

works as expected.

grail 04-20-2016 01:27 AM

Please mark as SOLVED once you have a solution.


All times are GMT -5. The time now is 04:02 AM.