Update.
[scripts.git] / bashrc
diff --git a/bashrc b/bashrc
index cb98ffa..adef316 100644 (file)
--- a/bashrc
+++ b/bashrc
@@ -23,11 +23,11 @@ PRIVATE_BASHRC="${HOME}/private/bashrc.perso"
 
 # If the MANPATH is not set, set it
 
-[ "${MANPATH}" ] || MANPATH=$(manpath)
+[[ "${MANPATH}" ]] || MANPATH=$(manpath)
 
 # If the private bashrc exists, execute it
 
-[ -f "${PRIVATE_BASHRC}" ] && source "${PRIVATE_BASHRC}"
+[[ -f "${PRIVATE_BASHRC}" ]] && source "${PRIVATE_BASHRC}"
 
 # !!! THIS HAS TO BE HERE EVEN IN THE NON-INTERACTIVE PART OR YOU WILL
 # LOSE YOU PREVIOUS HISTORY !!!
@@ -54,6 +54,8 @@ shopt -s histappend
 
 setterm -blength 0
 
+# || setterm --blength 0 # Seriously?
+
 ######################################################################
 ## The interactive part
 
@@ -168,7 +170,9 @@ function latexdiff () {
 # corresponding tex file
 
 function rl () {
-    RECENT_LOG=$(ls -t $(find -maxdepth 1 -name "*.log" -type f) | head -1)
+    # RECENT_LOG=$(ls -t $(find -maxdepth 1 -name "*.log" -type f) | head -1)
+
+    RECENT_LOG=$(ls -t *.log | head -1)
 
     if [[ ${RECENT_LOG} ]]; then
         FILEBASE="${RECENT_LOG/.log/}"
@@ -238,10 +242,11 @@ function bak () {
     done
 }
 
-# Password generator
+# A password generator
 
-function pwgen () {
+function genpw () {
     tr -dc A-Za-z0-9 < /dev/urandom | head -c16
+    # tr -dc [:graph:] < /dev/urandom | head -c16
     echo
 }
 
@@ -364,7 +369,7 @@ function pho () {
 function dt () {
     echo "Local: $(date)"
     if [[ ${TZ} ]]; then
-        unset TZ
+        local TZ=$(cat /etc/timezone)
         echo "Home:  $(date)"
     fi
 }
@@ -540,12 +545,12 @@ function keep () {
 # I sometime burn CDs and DVDs
 
 function burn () {
-    DEVICE="/dev/cdrw1"
+    [[ "${DEV_BURNER}" ]] || DEV_BURNER="/dev/sr0"
     if [[ ! "$1" ]]; then
         echo "burn <iso name | dirname>" >&2
     elif [[ -f "$1" ]]; then
         if [[ $(file "$1" | \grep -E 'ISO 9660|UDF filesystem data') ]]; then
-            wodim -eject -v dev=${DEVICE} "$1"
+            wodim -eject -v dev=${DEV_BURNER} "$1"
         else
             echo "Do not know what to do with $1" >&2
         fi
@@ -554,7 +559,7 @@ function burn () {
         echo "Using ${TMP_ROOT} as temporary directory."
         TMP=$(mktemp ${TMP_ROOT}/cdimage.XXXXXX) && \
             genisoimage -input-charset iso8859-1 -r -o ${TMP} "$1" && \
-            wodim -eject -v dev=${DEVICE} ${TMP}
+            wodim -eject -v dev=${DEV_BURNER} ${TMP}
         rm -f ${TMP}
     else
         echo "Can not find $1" >&2
@@ -623,6 +628,12 @@ alias ripcd=abcde
 
 function mksmall () {
 
+    if [[ "$1" == "--params" ]]; then
+        shift
+        PARAMS="$1"
+        shift
+    fi
+
     [[ "${PARAMS}" ]] || PARAMS="-geometry 800x600"
 
     # Auto-orient does not seem to work at all, hence the ugly hack
@@ -781,6 +792,8 @@ alias finddup='finddup -p'
 #
 # git clone http://fleuret.org/git/selector/
 
+export SELECTOR_CD_HISTORY_SIZE=10000
+
 source bash-selector.sh --hist --cd
 
 ######################################################################
@@ -852,6 +865,9 @@ function lsn () {
 ######################################################################
 
 function prompt_command () {
+    # if [[ $(umask) != 0022 ]]; then
+        # echo "Umask changed to $(umask)"
+    # fi
     # save the history after every command to avoid loosing some when
     # multiple shells are open
     history -a
@@ -870,7 +886,7 @@ PROMPT_COMMAND="prompt_command"
 # Displaying the timezone if it is set
 
 if [[ ${TZ} ]]; then
-    echo "${VT_BOLD}${VT_GREEN_FG}Time zone is ${TZ}.${VT_RESET}"
+    echo "${VT_BOLD}${VT_BLUE_FG}Time zone is ${TZ}.${VT_RESET}"
 fi
 
 ######################################################################