control aliases by tty
Is there a way to control a users alias by the tty that they are logged in as.
I have a green-screen terminal that I need to have root access on, but my root acount has some aliases that are not compatible on the green-screen terminal. example alias ls='ls -a --color' The --color is causing jumbled characters on the terminal. I really like this option on the main console so I don't really want to get rid of it. I would like to void the alias when I log in on ttyS0 as the root account. I know I can do a \ls to escape the alias but I am hoping for a more convenient method. Any suggestions or alternate methods would be a great help. |
std app called "env" shows all variables when logged in, look for value exact/aproximating the dev TTY device (Im using SSH_TTY for now), when using bash, on login first .bash_profile is executed, then .bash_login (if necessary), then .bashrc. user-specific aliases are in .bashrc, we can have either .bash_profile or .bashrc check for a few values, and assign the alias like:
TTY=$(echo $SSH_TTY | cut -d "/" -f 3 | cut -c 1-4) if [ $TTY = ttyp ]; then alias ls='ls -a --color' else alias ls='ls -a' fi 1. insert for "$SSH_TTY" the /dev/tty value u want (get from env), the "TTY=" line will return the 1st 4 chars like "ttyS" 2. same for "ttyp" HTH |
Thanks a lot, I should have thought of this myself.
|
All times are GMT -5. The time now is 10:41 PM. |