obosdi-pkg/config/bash/aliases

102 lines
4.8 KiB
Text
Raw Normal View History

2015-08-20 14:37:06 -06:00
#!/bin/bash
. ./lib
options=()
options+=("ls" "ls --color=auto -l --time-style long-iso" on)
options+=("ls(2)" "ls --color=auto -l" off)
options+=("ls(3)" "ls --color=auto" off)
options+=("l" "ls --color=auto -lA --time-style long-iso" on)
options+=("l(2)" "ls --color=auto -lA" off)
options+=("ll" "ls --color=auto -la --time-style long-iso" on)
options+=("ll(2)" "ls --color=auto -la" off)
options+=("cd.." "cd .." on)
options+=(".." "cd .." on)
options+=("..." "cd ../../../" on)
options+=("...." "cd ../../../../" on)
options+=("....." "cd ../../../../" on)
options+=("ff" "find / -name" on)
options+=("f" "find . -name" on)
options+=("grep" "grep --color=auto" on)
options+=("egrep" "egrep --color=auto" on)
options+=("fgrep" "fgrep --color=auto" on)
2017-06-11 09:25:31 -06:00
options+=("ip" "alias ip='ip -c'" on)
options+=("pacman" "pacman --color auto" on)
options+=("pactree" "pactree --color" on)
options+=("vdir" "vdir --color=auto" on)
options+=("watch" "watch --color" on)
options+=("man" "color function" on)
2015-08-20 14:37:06 -06:00
options+=("mkdir" "mkdir -pv" off)
2018-07-22 09:25:41 -06:00
if [ -f /usr/bin/trizen ]; then
options+=("trizen" "sudo -u aurbuilder trizen" on)
fi
2018-07-22 10:39:19 -06:00
if [ -f /usr/bin/yay ]; then
options+=("yay" "sudo -u aurbuilder yay" on)
fi
if [ -f /usr/bin/aurman ]; then
options+=("aurman" "sudo -u aurbuilder aurman" on)
fi
2017-05-07 07:44:41 -06:00
if [ -f /usr/bin/yaourt ]; then
2017-06-11 09:25:31 -06:00
options+=("yaourt" "sudo -u aurbuilder yaourt --color" on)
options+=("yaourt(2)" "sudo -u aurbuilder yaourt" off)
options+=("yaourt(3)" "yaourt --color" off)
2017-05-07 07:44:41 -06:00
fi
2015-08-20 14:37:06 -06:00
sel=$(whiptail --backtitle "$apptitle" --title "Aliases in /etc/profile.d/alias.sh :" --checklist "" --cancel-button "Back" 0 0 0 \
2017-06-11 09:25:31 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
2015-08-20 14:37:06 -06:00
if [ ! "$?" = "0" ]; then
2017-06-11 09:25:31 -06:00
exit 1
2015-08-20 14:37:06 -06:00
fi
rm /etc/profile.d/alias.sh > /dev/null
echo "#!/bin/bash" > /etc/profile.d/alias.sh
chmod 755 /etc/profile.d/alias.sh
for itm in $sel; do
2017-06-11 09:25:31 -06:00
case $itm in
'"ls"') echo "alias ls='ls --color=auto -l --time-style long-iso'" >> /etc/profile.d/alias.sh;;
'"ls(2)"') echo "alias ls='ls --color=auto -l'" >> /etc/profile.d/alias.sh;;
'"ls(3)"') echo "alias ls='ls --color=auto'" >> /etc/profile.d/alias.sh;;
'"l"') echo "alias l='ls --color=auto -lA --time-style long-iso'" >> /etc/profile.d/alias.sh;;
'"l(2)"') echo "alias l='ls --color=auto -lA'" >> /etc/profile.d/alias.sh;;
'"ll"') echo "alias ll='ls --color=auto -la --time-style long-iso'" >> /etc/profile.d/alias.sh;;
'"ll(2)"') echo "alias ll='ls --color=auto -la'" >> /etc/profile.d/alias.sh;;
'"cd.."') echo "alias cd..='cd ..'" >> /etc/profile.d/alias.sh;;
'".."') echo "alias ..='cd ..'" >> /etc/profile.d/alias.sh;;
'"..."') echo "alias ...='cd ../../'" >> /etc/profile.d/alias.sh;;
'"...."') echo "alias ....='cd ../../../'" >> /etc/profile.d/alias.sh;;
'"....."') echo "alias .....='cd ../../../../'" >> /etc/profile.d/alias.sh;;
'"ff"') echo "alias ff='find / -name'" >> /etc/profile.d/alias.sh;;
'"f"') echo "alias f='find . -name'" >> /etc/profile.d/alias.sh;;
'"grep"') echo "alias grep='grep --color=auto'" >> /etc/profile.d/alias.sh;;
'"egrep"') echo "alias egrep='egrep --color=auto'" >> /etc/profile.d/alias.sh;;
'"fgrep"') echo "alias fgrep='fgrep --color=auto'" >> /etc/profile.d/alias.sh;;
'"ip"') echo "alias ip='ip -c'" >> /etc/profile.d/alias.sh;;
'"pacman"') echo "alias pacman='pacman --color auto'" >> /etc/profile.d/alias.sh;;
'"pactree"') echo "alias pactree='pactree --color'" >> /etc/profile.d/alias.sh;;
'"vdir"') echo "alias vdir='vdir --color=auto'" >> /etc/profile.d/alias.sh;;
'"watch"') echo "alias watch='watch --color'" >> /etc/profile.d/alias.sh;;
'"man"')
2017-06-11 09:34:25 -06:00
echo 'man() {' >> /etc/profile.d/alias.sh
echo ' env \' >> /etc/profile.d/alias.sh
echo ' LESS_TERMCAP_mb=$(printf "\e[1;31m") \' >> /etc/profile.d/alias.sh
echo ' LESS_TERMCAP_md=$(printf "\e[1;31m") \' >> /etc/profile.d/alias.sh
echo ' LESS_TERMCAP_me=$(printf "\e[0m") \' >> /etc/profile.d/alias.sh
echo ' LESS_TERMCAP_se=$(printf "\e[0m") \' >> /etc/profile.d/alias.sh
echo ' LESS_TERMCAP_so=$(printf "\e[1;44;33m") \' >> /etc/profile.d/alias.sh
echo ' LESS_TERMCAP_ue=$(printf "\e[0m") \' >> /etc/profile.d/alias.sh
echo ' LESS_TERMCAP_us=$(printf "\e[1;32m") \' >> /etc/profile.d/alias.sh
echo ' man "$@"' >> /etc/profile.d/alias.sh
echo '}' >> /etc/profile.d/alias.sh
2017-06-11 09:25:31 -06:00
;;
'"mkdir"') echo "alias mkdir='mkdir -pv'" >> /etc/profile.d/alias.sh;;
2018-07-22 09:25:41 -06:00
'"trizen"') echo "alias trizen='sudo -u aurbuilder trizen'" >> /etc/profile.d/alias.sh;;
2018-07-22 10:39:19 -06:00
'"yay"') echo "alias yay='sudo -u aurbuilder yay'" >> /etc/profile.d/alias.sh;;
'"aurman"') echo "alias aurman='sudo -u aurbuilder aurman'" >> /etc/profile.d/alias.sh;;
2017-06-11 09:25:31 -06:00
'"yaourt"') echo "alias yaourt='sudo -u aurbuilder yaourt --color'" >> /etc/profile.d/alias.sh;;
'"yaourt(2)"') echo "alias yaourt='sudo -u aurbuilder yaourt'" >> /etc/profile.d/alias.sh;;
'"yaourt(3)"') echo "alias yaourt='yaourt --color'" >> /etc/profile.d/alias.sh;;
esac
2015-08-20 14:37:06 -06:00
done
2017-05-07 07:44:41 -06:00
exit 0