obosdi-pkg/config/bash/aliases

57 lines
2.6 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)
options+=("mkdir" "mkdir -pv" off)
sel=$(whiptail --backtitle "$apptitle" --title "Aliases in /etc/profile.d/alias.sh :" --checklist "" --cancel-button "Back" 0 0 0 \
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ ! "$?" = "0" ]; then
exit 1
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
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;;
'"mkdir"') echo "alias mkdir='mkdir -pv'" >> /etc/profile.d/alias.sh;;
esac
done
exit 0