Allow zsh to work with bashrc

This commit is contained in:
Anthony Rose 2022-08-18 08:44:25 +01:00
parent c251514a8b
commit a4bcc82a42
4 changed files with 38 additions and 3 deletions

View file

@ -8,6 +8,13 @@ else
export ACP="$HOME/data" export ACP="$HOME/data"
fi fi
if [ -n "$ZSH_VERSION" ]
then
# These commands do not exist in zsh.
alias bind=false
alias shopt=false
fi
if [ -f /etc/bashrc ] if [ -f /etc/bashrc ]
then then
. /etc/bashrc . /etc/bashrc
@ -78,7 +85,7 @@ export PAPERSIZE=a4
export POWERSHELL_TELEMETRY_OPTOUT=1 export POWERSHELL_TELEMETRY_OPTOUT=1
export PYTHONWARNINGS=ignore::UserWarning export PYTHONWARNINGS=ignore::UserWarning
if [ "$(uname -s)" == "Darwin" ] if [ "x$(uname -s)" = "xDarwin" ]
then then
export BASH_SILENCE_DEPRECATION_WARNING=1 export BASH_SILENCE_DEPRECATION_WARNING=1
fi fi
@ -100,7 +107,7 @@ else
export EDITOR=vi export EDITOR=vi
fi fi
if [ ${XDG_CURRENT_DESKTOP:-unknown} == GNOME ] if [ ${XDG_CURRENT_DESKTOP:-unknown} = GNOME ]
then then
export QT_FONT_DPI=72 export QT_FONT_DPI=72
fi fi
@ -115,6 +122,11 @@ bind 'set completion-ignore-case on'
bind 'set enable-bracketed-paste off' bind 'set enable-bracketed-paste off'
export PS1="\[\033[01m\]\u@\h>\[\033[00m\] " export PS1="\[\033[01m\]\u@\h>\[\033[00m\] "
if [ -n "$ZSH_VERSION" ]
then
export PS1="%B%n@%m>%b "
fi
if test $(id -u) -ne 0 && test -x /usr/bin/dnf if test $(id -u) -ne 0 && test -x /usr/bin/dnf
then then
alias dnf="dnf --cacheonly --nogpgcheck" alias dnf="dnf --cacheonly --nogpgcheck"
@ -264,7 +276,7 @@ usermotd () {
then then
echo " $(. /etc/os-release; echo $NAME $VERSION)" echo " $(. /etc/os-release; echo $NAME $VERSION)"
fi fi
if [ "x$(uname -s)" == "xDarwin" ] if [ "x$(uname -s)" = "xDarwin" ]
then then
echo " $(sw_vers -productName) $(sw_vers -productVersion)" echo " $(sw_vers -productName) $(sw_vers -productVersion)"
fi fi
@ -309,3 +321,10 @@ case "$-" in
*) *)
;; ;;
esac esac
if [ -n "$ZSH_VERSION" ]
then
# These commands do not exist in zsh.
unalias shopt
unalias bind
fi

View file

@ -0,0 +1,4 @@
if [ -e $HOME/.bash_profile ]
then
emulate sh -c ". $HOME/.bash_profile"
fi

View file

@ -0,0 +1,4 @@
if [ -e $HOME/.bashrc ]
then
emulate sh -c ". $HOME/.bashrc"
fi

View file

@ -21,3 +21,11 @@
ansible.builtin.copy: ansible.builtin.copy:
src: bash_profile src: bash_profile
dest: "{{ ansible_env.HOME }}/.bash_profile" dest: "{{ ansible_env.HOME }}/.bash_profile"
- name: Copy .zshrc
ansible.builtin.copy:
src: zshrc
dest: "{{ ansible_env.HOME }}/.zshrc"
- name: Copy .zprofile
ansible.builtin.copy:
src: zprofile
dest: "{{ ansible_env.HOME }}/.zprofile"