Fixed multiple bugs related to spaces in filenames.
[scripts.git] / bashrc
diff --git a/bashrc b/bashrc
index 30a4995..ac6d696 100644 (file)
--- a/bashrc
+++ b/bashrc
@@ -109,12 +109,14 @@ if [ -e "${HOME}/.dircolors" ]; then
     # alias ll='ls --color -lth'
     alias lt='ls --color -gohtr --time-style="+%Y %b %d %H:%M"'
     alias ll='ls --color -goh --time-style="+%Y %b %d %H:%M"'
+    alias lll='ls --color -lth'
     alias l='ls --color -I "*~" -I "*.o"'
     alias less='less -R'
 else
     # alias ll='ls -lth'
     alias lt='ls -gohtr --time-style="+%Y %b %d %H:%M"'
     alias ll='ls -goh --time-style="+%Y %b %d %H:%M"'
+    alias lll='ls -lth'
     alias l='ls -I "*~" -I "*.o"'
 fi
 
@@ -134,7 +136,7 @@ export FIGNORE="CVS"
 function fn () {
     name=$1
     shift
-    find $* -name "*${name}*";
+    find "$@" -name "*${name}*";
 }
 
 # Create a dir and cd there
@@ -147,8 +149,14 @@ function mcd () {
 # Capture the screen in a dated png
 
 function cap () {
-    name="capture-$(date +%s).png"
+    if [[ $2 ]]; then
+        name=$2
+    else
+        name="capture-$(date +%s).png"
+    fi
+    echo "Waiting $1 s and saving to ${name}."
     [[ $1 ]] && sleep $1
+    echo "Please click on the window to capture."
     xwd  | convert - ${name}
     \ls -l ${name}
 }
@@ -206,7 +214,7 @@ function map () {
 function pho () {
     PHO_BIN=/usr/bin/pho
     TEMP=$(mktemp /tmp/pho.XXXXXXX)
-    ${PHO_BIN} $* | tee ${TEMP}
+    ${PHO_BIN} "$@" | tee ${TEMP}
     PHO_NOTE_1=$(grep ^"Note 1: " ${TEMP} | sed -e "s/^[^:]*: //")
     PHO_NOTE_2=$(grep ^"Note 2: " ${TEMP} | sed -e "s/^[^:]*: //")
     PHO_NOTE_3=$(grep ^"Note 3: " ${TEMP} | sed -e "s/^[^:]*: //")
@@ -254,7 +262,7 @@ function ifup () {
     echo "${VT_BOLD}${VT_GREEN_FG}This is the bash function ifup from .bashrc${VT_RESET}"
     if [[ "$1" == "-s" ]]; then
         chosen_ifup=$(mktemp /tmp/chosen_ifup.XXXXXX)
-        selector -o ${chosen_ifup} <(cat ${IFUPRC} | sort | uniq)
+        selector -i -d -o ${chosen_ifup} ${IFUPRC}
         ARGS=$(cat ${chosen_ifup})
         rm -f ${chosen_ifup}
         echo ${ARGS} >> ${IFUPRC}
@@ -306,8 +314,9 @@ function checkgw () {
 function lr () {
     HEIGHT=$(stty size | awk '{print $1}')
     WIDTH=$(stty size | awk '{print $2}')
-    \ls -goth  --time-style="+%Y %b %d %H:%M" $* | head -$((HEIGHT-2)) | cut -b1-${WIDTH}
-    # \ls -lth $* | head -$((HEIGHT-2)) | cut -b1-${WIDTH}
+    \ls -goth --time-style="+%Y %b %d %H:%M" "$@" | \
+        head -$((HEIGHT-2)) | \
+        cut -b1-${WIDTH}
 }
 
 ######################################################################