Questions on setting up aliases, .bashrc
I've a question. I want to create this alias, amongst others: alias onic='ssh -l bubonic zippy.shellyeah.org ' I can do that and the alias will work, but after I'm done and close the x-terminal, I lose the alias. How do I keep the alias saved? If I just type 'alias' or 'alias -p', I get a listing of all existing aliases, so I KNOW they are being stored somewhere.... One of my books, Peter Norton's Complete Guide to Linux, says that I can add the above alias to ~/.bashrc. If I type 'alias', this is what I see: ___________ ron@500mhz:~ > alias alias +='pushd .' alias -='popd' alias ..='cd ..' alias ...='cd ../..' alias A:='echo -e '\''Error: There is no such thing as a drive A: in Un*x!\nUse mtools, mount or autofs to access your floppy.'\''' alias C:='echo -e '\''Error: There is no such thing as a drive C: in Un*x!\nYour harddisk should already be mounted (via /etc/fstab or autofs).'\''' alias beep='echo -en "\x07"' alias cd..='echo '\''Error: Try: cd ..'\''' alias chkdsk='echo -e '\''Error: Your filesystems are checked on bootup.\nIf you want to do it manually, use fsck.\n Use df and mount for an overview of your disks.'\''' alias copy='echo '\''Error: Try the command: cp -piv'\''' alias del='echo '\''Error: Try the command: rm -iv'\''' alias dir='ls -l' ___________ If I type 'cat .bashrc' when in my home directory, this is what I see: ___________ ron@500mhz:~ > cat .bashrc # Bash knows 3 diferent shells: normal shell, interactive shell, login shell. # ~/.bashrc is read for interactive shells and ~/.profile is read for login # shells. We just let ~/.profile also read ~/.bashrc and put everything in # ~/.bashrc. test -z "$PROFILEREAD" && . /etc/profile # Some people like DOS like aliases if test -f /etc/profile.dos ; then . /etc/profile.dos fi #alias hilbert='finger @hilbert.suse.de' #export EDITOR=/usr/bin/pico #export NNTPSERVER=news.suse.de # commands common to all logins if ! [ $TERM ] ; then eval `tset -s -Q` case $TERM in con*|vt100) tset -Q -e ^? ;; esac fi # # nearly no known program needs $TERMCAP - 'Slang'-programs get confused # with a set $TERMCAP -> unset it. # unset TERMCAP # Some programs support several languages for their output. # If you want them to use german, please uncomment the following line. #export LANG=de_DE.ISO-8859-1 # # try to set DISPLAY smart (from Hans) :) # if test -z "$DISPLAY" -a "$TERM" = "xterm" -a -x /usr/bin/who ; then WHOAMI="`/usr/bin/who am i`" _DISPLAY="`expr "$WHOAMI" : '.*(\([^\.][^\.]*\).*)'`:0.0" if [ "${_DISPLAY}" != ":0:0.0" -a "${_DISPLAY}" != " :0.0" \ -a "${_DISPLAY}" != ":0.0" ]; then export DISPLAY="${_DISPLAY}"; fi unset WHOAMI _DISPLAY fi test -e ~/.alias && . ~/.alias export DISPLAY LESS PS1 PS2 umask 022 ___________ Excuse me for copying and pasting all that...I don't know if the info is pertinent to any help that may be sent my way, so I decided to include it with this post. My question is, why isn't the first list of aliases in the .bashrc above? Or, should I just go ahead and put my 'alias onic='ssh -l bubonic zippy.shellyeah.org '' statement in the .bashrc above, though it would seem to be out of place? I'm at a loss here. Is this due to Suse (or my Slackware on my other box) using a nonstandard .bashrc? Slackware 7.0 doesn't even have 'alias' or a .bashrc. WTF? I suppose I could make a shell function, which should work with both Slackware AND Suse, but my curiosity is now piqued...I want to know why all those aliases aren't listed in .bashrc like ole' Peter Norton said they'd be. :o) TIA -- Ron Sinclair @ http://www.wigglit.com
First of all the one line I left from your message explains where you
should create your own aliases. Create in you home directory a file called
.alias and add all your own aliases in there.
If you want to create system wide aliases so all users will get them you
can put them in /etc/profile.local.
Second, the system wide aliases are stored in /etc/profile
Avi
--On Tuesday, October 16, 2001 12:31:48 PM +0900 Ron Sinclair
I've a question.
I want to create this alias, amongst others:
alias onic='ssh -l bubonic zippy.shellyeah.org '
I can do that and the alias will work, but after I'm done and close the x-terminal, I lose the alias. How do I keep the alias saved?
If I just type 'alias' or 'alias -p', I get a listing of all existing aliases, so I KNOW they are being stored somewhere....
test -e ~/.alias && . ~/.alias
-- Avi Schwartz avi@CFFtechnologies.com "I have to share the credit. I invented it, but Bill made it famous." - IBM engineer Dave Bradley describing the control-alt-delete reboot sequence
I got it to work by creating ~/.alias and made a few aliases...they work. I didn't put it in /etc/profile since I'm the only user. Even as root, I wouldn't be using the aliases (they are aliases for the web and I don't go on the web as root). Thanks for all the help. Once again, the Suse list pulls through! :o) -- Ron Sinclair @ http://www.wigglit.com On Tuesday 16 October 2001 12:41, Avi Schwartz wrote:
First of all the one line I left from your message explains where you should create your own aliases. Create in you home directory a file called ..alias and add all your own aliases in there.
If you want to create system wide aliases so all users will get them you can put them in /etc/profile.local.
Second, the system wide aliases are stored in /etc/profile
Avi
--On Tuesday, October 16, 2001 12:31:48 PM +0900 Ron Sinclair
wrote: I've a question.
I want to create this alias, amongst others:
alias onic='ssh -l bubonic zippy.shellyeah.org '
I can do that and the alias will work, but after I'm done and close the x-terminal, I lose the alias. How do I keep the alias saved?
If I just type 'alias' or 'alias -p', I get a listing of all existing aliases, so I KNOW they are being stored somewhere....
test -e ~/.alias && . ~/.alias
participants (2)
-
Avi Schwartz
-
Ron Sinclair