]> id.pley.net Git - dotfiles.git/blobdiff - zsh_aliases
Added has() function; made EDITOR variables dependent on whether terminal is remote.
[dotfiles.git] / zsh_aliases
index 80f9c856ed2e2455d37302b7064e04591b8fd22d..f3307028ed3a578bb76c49721eca2be786108916 100644 (file)
@@ -51,8 +51,18 @@ function viw () { vi $(which $1); }
 function toss () { mv -f $@ ~/.trashcan; }
 function xcopy () { tar cvf - -C $1 $1/* | tar xvf - -C $2; }
 function checkdns () { ping $( grep nameserver /etc/resolv.conf | awk '{print $2}' | head -1); }
+function has () { 
+    which $1 &> /dev/null
+    if [[ $? -eq 0 ]]; then
+        echo 'yes'
+        return 0
+    else
+        echo 'no'
+        return 1
+    fi
+}
 
-if [[ $(/usr/bin/which -s pidof) -eq 0 ]]; then
+if [[ $( has pidof ) == 'no'  ]]; then
     function pidof () { ps -e -o pid,comm | grep "$1" | awk '{print $1}'; }
 fi