Mainos / Advertisement:
Ero sivun ”Bashrc/en” versioiden välillä
Siirry navigaatioon
Siirry hakuun
(Ak: Uusi sivu: Bashrc) |
(Ak: Uusi sivu: We close the connection and restart. Auto completion should function properly.) |
||
(8 välissä olevaa versiota samalta käyttäjältä ei näytetä) | |||
Rivi 1: | Rivi 1: | ||
<languages/> | <languages/> | ||
− | + | By modifying the /etc/bash.bashrc file you can do a lot of funny stuff to bash | |
nano /etc/bash.bashrc | nano /etc/bash.bashrc | ||
− | + | By default it should be like | |
[ -z "$PS1" ] && return | [ -z "$PS1" ] && return | ||
Rivi 12: | Rivi 12: | ||
fi | fi | ||
− | + | And we modify it into: | |
[ -z "$PS1" ] && return | [ -z "$PS1" ] && return | ||
Rivi 23: | Rivi 23: | ||
fi | fi | ||
− | + | If you want to allow bash for all users, modify | |
/home/%USERNAME%/.bashrc | /home/%USERNAME%/.bashrc | ||
− | + | and remove the number sign (#) | |
force_color_prompt=yes | force_color_prompt=yes | ||
Rivi 33: | Rivi 33: | ||
− | == | + | == When tab (auto completion) does not work in "interactive shells" (e.g. ssh) == |
− | + | Uncomment the following lines. | |
# enable bash completion in interactive shells | # enable bash completion in interactive shells | ||
Rivi 42: | Rivi 42: | ||
#fi | #fi | ||
− | + | Like so | |
# enable bash completion in interactive shells | # enable bash completion in interactive shells | ||
Rivi 49: | Rivi 49: | ||
fi | fi | ||
− | + | We close the connection and restart. Auto completion should function properly. |
Nykyinen versio 10. helmikuuta 2015 kello 06.43
By modifying the /etc/bash.bashrc file you can do a lot of funny stuff to bash
nano /etc/bash.bashrc
By default it should be like
[ -z "$PS1" ] && return shopt -s checkwinsize if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi
And we modify it into:
[ -z "$PS1" ] && return shopt -s checkwinsize if [ $(id -u) -eq 0 ]; then PS1="\\[$(tput setf 5)\\]\\u@\\H:\\w #\\[$(tput sgr0)\\]" else PS1="[\\u@\\h:w] $" fi
If you want to allow bash for all users, modify
/home/%USERNAME%/.bashrc
and remove the number sign (#)
force_color_prompt=yes
When tab (auto completion) does not work in "interactive shells" (e.g. ssh)
Uncomment the following lines.
# enable bash completion in interactive shells #if [ -f /etc/bash_completion ] && ! shopt -oq posix; then # . /etc/bash_completion #fi
Like so
# enable bash completion in interactive shells if [ -f /etc/bash_completion ] && ! shopt -oq posix; then . /etc/bash_completion fi
We close the connection and restart. Auto completion should function properly.
Mainos / Advertisement: