Commits

Jason Ryan committed 5bd2cec

Continuing the great cleanup

  • Participants
  • Parent commits 45bf052

Comments (0)

Files changed (10)

File Scripts/abpkg

 
 absversion() {
   # vim is special; yes, this is truly ugly…
-  if [[ "${target#*s/}" == "extra/vim" ]]; then
+  if [[ ${target#*s/} == extra/vim ]]; then
     vim=($(awk '/^_topver/,/^pkgrel/' ${target}/PKGBUILD))
     avers="${vim[0]:8}.${vim[1]:12}-${vim[5]:7}"
   else
       absversion
 
       # synchronize repo
-      if [[ "$avers" < "$rvers" ]]; then
+      if [[ $avers < $rvers ]]; then
         printf "%s\n\n" "Updating ABS $1 package…"
         /usr/bin/abs "${target#*s/}" >/dev/null
         absversion
       printf "%s\n%s\n" "${mag}ABS version${end}" "$avers"
 
       # locally installed?
-      if [[ -n "$ivers" ]]; then
+      if [[ -n $ivers ]]; then
         printf "\n%s\n%s\n" "${cyn}Installed${end}" "$ivers"
       else
         printf "\n%s\n" "${red}${name} not installed…${end}"

File Scripts/archbak

 back="$HOME/Centurion/Archer"
 dirs=("$HOME/.config" "$HOME/Scripts" "$HOME/Build/dwm" "$HOME/Build/vimprobable2-git")
 
-if [ -z "$lan" ]; then 
+if [[ -z $lan ]]; then 
     printf "%s\n" "Not on home LAN; exiting…"
     exit 1
 fi
 
-if [[ -d "$back" ]]; then
+if [[ -d $back ]]; then
     printf "%s\n" "Already mounted..."
 else
     sudo mount.nfs 192.168.1.100:/home/jason $HOME/Centurion

File Scripts/archshot

 
 
 # if X is running
-if [[ "$DISPLAY" ]]; then
+if [[ $DISPLAY ]]; then
     # check for running wm
     for w in "${wms[@]}"; do
         if pidof "$w" &>/dev/null; then

File Scripts/brightness

 
 notify() {
   bright=$(</sys/class/backlight/acpi_video0/actual_brightness)
-  if (( "$bright" = 95 )); then
+  if (( $bright == 95 )); then
     score="100"
   else 
     score="$(( $bright * 100 / 95 ))"

File Scripts/checkaur

 orpfile=$(mktemp -t aurphans.XXXXXX)
 
 # remove old files
-[[ ( -e "$aurfile" && -e "$orpfile" ) ]] && rm /tmp/aur{phans,updates}*
+[[ ( -e $aurfile && -e $orpfile ) ]] && rm /tmp/aur{phans,updates}*
 
 # check for updates
 /usr/bin/cower --color=never -u > "$aurfile"

File Scripts/dismount

 
 checkbusy() {
   grep "PID" <(lsof +d "$target" &>/dev/null)
-  if [[ $? -eq 0 ]]; then
+  if (( $? == 0 )); then
     printf "%s\n" "${target##*/} busy…"
     exit 1
   fi
 }
 
 exstatus() {
-  if [[ $? -eq 0 ]]; then
+  if (( $? == 0 )); then
     printf "%s\n" "${target##*/} unmounted…"
   else
     printf "%s\n" "Failed to unmount."
 
 # check for share
 for drive in "${shares[@]}"; do
-  if [[ "$drive" = "${target##*/}" ]]; then
+  if [[ $drive = ${target##*/} ]]; then
     share="$drive"
   fi
 done
 
 # options per filesystem
-if [[ -n "$target" ]]; then
+if [[ -n $target ]]; then
   for drive in "${shares[@]}"; do
-    if [[ "$drive" = "${target##*/}" && "${target##*/}" = Safebox ]]; then
+    if [[ $drive = ${target##*/} && ${target##*/} = Safebox ]]; then
       cmd=$(sudo safebox close)
-    elif [[ "$drive" = "${target##*/}" ]]; then
+    elif [[ $drive = ${target##*/} ]]; then
       cmd=$(sudo umount "$target")
     else
       cmd=$(udiskie-umount -d "$target" &>/dev/null)

File Scripts/dwm-status

   track="$(mpc current)"
   artist="${track%%- *}"
   title="${track##*- }"
-  [[ -n "$artist" ]] && echo -e "\x06$artist\x01\x08$title\x01 •"
+  [[ -n $artist ]] && echo -e "\x06$artist\x01\x08$title\x01 •"
 }
 
 bat(){
   onl="$(</sys/class/power_supply/ADP1/online)"
   charge="$(</sys/class/power_supply/BAT1/capacity)"
-  if [[ "$onl" -eq 0 && $charge -ge 15 ]]; then
+  if [[ $onl -eq 0 && $charge -ge 15 ]]; then
     echo -e "BAT \x04$charge%\x01"
-  elif [[ "$onl" -eq 0 && $charge -le 14 ]]; then
+  elif [[ $onl -eq 0 && $charge -le 14 ]]; then
     echo -e "BAT \x03$charge%\x01"
   else
     echo -e "AC \x06$charge%\x01"
     END {if (NR==11) print a,b,c,d; else print a,b,c}
            ' <(df -P)) )
   drives="${#hd[@]}"
-  if (( "$drives" > 3 )); then
+  if (( $drives > 3 )); then
     echo -e "\x08${hd[@]:0:3} \x06${hd[@]:3:1}\x01"
   else
     echo -e "\x08${hd[@]}\x01"
 eml(){
   maildirs="$HOME/Mail/*/INBOX/new/"
   ml="$(find $maildirs -type f | wc -l)"
-  if (( "$ml" > 0 )); then
+  if (( $ml > 0 )); then
     echo -en "\x03$ml\x01"
   else
     echo "0"
 
 pac(){
   pup="$(pacman -Qqu --dbpath /tmp/checkup-db-jason/ | wc -l)"
-  if (( "$pup" > 0 )); then
+  if (( $pup > 0 )); then
     echo -en "\x05$pup\x01"
   else
     echo "0"
 
 ups(){
   ups="$(awk '$0 !~ /tamsyn/' /tmp/aurupdates* | wc -l)"
-  if (( "$ups" > 0 )); then
+  if (( $ups > 0 )); then
     echo -en "\x05$ups\x01"
   else
     echo "0"
 
 aur(){
    aur="$(awk '$0 !~ /^No /' /tmp/aurphans* | wc -l)"
-   if (( "$aur" > 0 )); then
+   if (( $aur > 0 )); then
      echo -en "\x03 ∆\x01"
    fi
 }

File Scripts/monitors

 screen="HDMI1"
 external=$(xrandr -q | awk '/HDMI1/ {print $2}')
 
-if [[ "$external" = connected ]]; then
+if [[ $external = connected ]]; then
   xrandr --output "$laptop" --auto --primary \
     --output "$screen" --auto --right-of "$laptop"
 else

File Scripts/pedit

 #!/usr/bin/env bash
 # edit posts in Octopress
 
-[[ ${PWD##*/} == "octopress" ]] || exit 1
+[[ ${PWD##*/} == octopress ]] || exit 1
 
-if (( $# = 1 )); then
+if (( $# == 1 )); then
 	find source/_posts/ -name "*$1*" -exec vim {} \;
 else
 	printf '%s\n' "Which post?" && exit 1

File Scripts/sysd

 done
 
 
-if (( $# = 2 )) && [[ $super == yes ]]; then 
+if (( $# == 2 )) && [[ $super == yes ]]; then 
     sudo systemctl "$1" "$2".service
 
-elif (( $# = 2 )) && [[ $1 == read ]]; then
+elif (( $# == 2 )) && [[ $1 == read ]]; then
     less -FX /usr/lib/systemd/system/"$2".service
 
-elif (( $# = 2 )); then
+elif (( $# == 2 )); then
     systemctl "$1" "$2".service
 fi
 
-if (( $# = 1 )); then
+if (( $# == 1 )); then
 
     case "$1" in
         list) systemctl list-units ;;