LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   setting alias in bash, permanently (https://www.linuxquestions.org/questions/linux-general-1/setting-alias-in-bash-permanently-273380/)

allelopath 01-03-2005 02:20 PM

setting alias in bash, permanently
 
I want to set some permanent aliases for the bash shell.
This would be for all users on my box, which would be my regular user acct and root.
I created the file /etc/profile.local and added some lines like:

alias cdcpp='cd /development/C++'
alias cddoc='cd /document'

but the aliases don't get defined.
I've even restarted the box to be certain.

What do I need to do?

SuSE 9.2 Pro

david_ross 01-03-2005 02:37 PM

They will only last for a bash session, you will need to reset them each time the shell is started. The easiest way would be to put them in your startup script ~/.bashrc or for all users /etc/bashrc

Blinker_Fluid 01-03-2005 02:43 PM

hmm never messed around with profile.local (set up a test one just for fun though)

Somethings to check:
does the following lines show up in your /etc/profile:
# And now let's see if there is a local profile
test -s /etc/profile.local && . /etc/profile.local

in my /etc/profile.local I put the following:
alias list=ls

After I logged out and logged back in 'list' appears to work.

allelopath 01-03-2005 02:57 PM

>>The easiest way would be to put them in ... for all users /etc/bashrc
My bash.bashrc file says:
# PLEASE DO NOT CHANGE /etc/bash.bashrc There are chances that your changes
# will be lost during system upgrades. Instead use /etc/bash.bashrc.local

>>does the following lines show up in your /etc/profile:
>># And now let's see if there is a local profile
>>test -s /etc/profile.local && . /etc/profile.local
yes

Blinker_Fluid 01-03-2005 03:18 PM

Both my /etc/profile.local and /etc/bash.bashrc.local work :scratch:

What kind of file permissions do you have on them? (does everyone have at least read access?)

allelopath 01-03-2005 04:02 PM

permissions are at least read.
/etc/bash.bashrc.local works (for both root and regular user)
but for some reason /etc/profile.local doesn't, maybe its a SuSE thing
anyway, good enough.
thanks for your help

please 10-24-2008 04:10 AM

the bash is will be affect when login ?

if I want to system start up without login, how can I do?


All times are GMT -5. The time now is 10:10 PM.