Add support for bash 3.0+

This commit is contained in:
Dylan 2016-02-24 09:30:11 +11:00
parent 786948f818
commit 616e4ec50f
2 changed files with 15 additions and 13 deletions

View File

@ -41,7 +41,6 @@ printinfo () {
# info "Public IP" public # info "Public IP" public
# info "Birthday" birthday # info "Birthday" birthday
# info "Song" song # info "Song" song
# info "Visual Style" visualstyle
info linebreak info linebreak
info cols info cols

27
fetch
View File

@ -19,8 +19,10 @@
# Created by Dylan Araps # Created by Dylan Araps
# https://github.com/dylanaraps/ # https://github.com/dylanaraps/
# Speed up script by not using unicode version=${BASH_VERSION/.*}
SYS_LOCALE="$LANG" SYS_LOCALE="$LANG"
# Speed up script by not using unicode
export LC_ALL=C export LC_ALL=C
export LANG=C export LANG=C
@ -59,7 +61,6 @@ printinfo () {
# info "Local IP" localip # info "Local IP" localip
# info "Public IP" public # info "Public IP" public
# info "Birthday" birthday # info "Birthday" birthday
# info "Visual Style" visualstyle
info linebreak info linebreak
info cols info cols
@ -935,7 +936,7 @@ getgpu () {
if [ "$gpu_shorthand" == "on" ]; then if [ "$gpu_shorthand" == "on" ]; then
gpu=${gpu// Rev\. ?} gpu=${gpu// Rev\. ?}
gpu=${gpu//AMD\/ATI/AMD} gpu=${gpu//AMD*\/ATI\]/AMD}
gpu=${gpu// Tahiti} gpu=${gpu// Tahiti}
gpu=${gpu// PRO} gpu=${gpu// PRO}
gpu=${gpu// OEM} gpu=${gpu// OEM}
@ -1153,11 +1154,7 @@ getstyle () {
if [ -n "$DISPLAY" ] && [ "$os" != "Mac OS X" ]; then if [ -n "$DISPLAY" ] && [ "$os" != "Mac OS X" ]; then
# Current DE # Current DE
desktop="$XDG_CURRENT_DESKTOP" case "$XDG_CURRENT_DESKTOP" in
desktop=${desktop,,}
desktop=${desktop^}
case "$desktop" in
"KDE"*) "KDE"*)
if type -p kde5-config >/dev/null 2>&1; then if type -p kde5-config >/dev/null 2>&1; then
kde_config_dir=$(kde5-config --localprefix) kde_config_dir=$(kde5-config --localprefix)
@ -1174,7 +1171,7 @@ getstyle () {
theme=$(grep "^[^#]*$kde" "$kde_config_file") theme=$(grep "^[^#]*$kde" "$kde_config_file")
theme=${theme/${kde}*=} theme=${theme/${kde}*=}
theme=${theme^} [ "$version" -ge 4 ] && theme=${theme^}
gtk_shorthand="on" gtk_shorthand="on"
return return
@ -1244,8 +1241,10 @@ getstyle () {
fi fi
# Uppercase the first letter of each gtk theme # Uppercase the first letter of each gtk theme
gtk2theme=${gtk2theme^} if [ "$version" -ge 4 ]; then
gtk3theme=${gtk3theme^} gtk2theme=${gtk2theme^}
gtk3theme=${gtk3theme^}
fi
# Toggle visibility of gtk themes. # Toggle visibility of gtk themes.
[ "$gtk2" == "off" ] && unset gtk2theme [ "$gtk2" == "off" ] && unset gtk2theme
@ -1604,7 +1603,11 @@ getascii () {
if [ "$ascii" == "distro" ]; then if [ "$ascii" == "distro" ]; then
# Lowercase the distro name # Lowercase the distro name
ascii=${ascii_distro,,} if [ "$version" -le 3 ]; then
ascii=$(tr '[:upper:]' '[:lower:]' <<< "$ascii_distro")
else
ascii=${ascii_distro,,}
fi
# Check /usr/share/fetch for ascii before # Check /usr/share/fetch for ascii before
# looking in the script's directory. # looking in the script's directory.