« first day (1157 days earlier)      last day (1888 days later) » 

 
6 hours later…
6:14 AM
@Queen f
 
 
2 hours later…
9:10 AM
@Queen k but already used my close vote
 
@Queen k
 
 
1 hour later…
10:55 AM
Heya, this might be the wrong room but I have a question about using `alias` in bash.

I created the following
`alias python='python3'

It works as expected, usually. However, when I run `sudo python` I expected it to run python3 as sudo. Instead it opens the default python2.7.

Do alias not work anymore with sudo in front of them? :/
 
11:55 AM
@MitchellvanZuylen no, sudo creates a new session as a new user
21
Q: Why does sudo ignore aliases?

amphibientI am running Ubuntu 10.04 and I use upstart for daemon management. My enterprise application is run as a daemon and must be run as root because of various privileges. E.g.: sudo start my-application-long-ID sudo stop my-application-long-ID etc I would like to introduce an alias to abbreviate...

there's a wacky workaround in the accepted answer there ^ but really, just get used to typing python3 would be my suggestion
or put a shebang in your scripts and basically never spell out separately which interpreter to use, which nicely avoids the problem entirely
for f in *.py; do sed -i '~'  '1i\
#!/usr/bin/env python3' "$f"; done
probably somewhat system-dependent but works for me
also tangentially functions are better than aliases at almost every junction
 
@Queen k
 
 
2 hours later…
3:35 PM
@Queen k
 
 
4 hours later…

« first day (1157 days earlier)      last day (1888 days later) »