Update.
[scripts.git] / bashrc
diff --git a/bashrc b/bashrc
index b7e3262..cb98ffa 100644 (file)
--- a/bashrc
+++ b/bashrc
@@ -238,6 +238,13 @@ function bak () {
     done
 }
 
+# Password generator
+
+function pwgen () {
+    tr -dc A-Za-z0-9 < /dev/urandom | head -c16
+    echo
+}
+
 function ua () {
 
     [[ "$1" ]] || ( echo "Universal unarchive: ua <file> [<file> ...]" >&2 && return 1)
@@ -616,7 +623,7 @@ alias ripcd=abcde
 
 function mksmall () {
 
-    PARAMS="-geometry 800x600"
+    [[ "${PARAMS}" ]] || PARAMS="-geometry 800x600"
 
     # Auto-orient does not seem to work at all, hence the ugly hack
     # with exif below
@@ -703,25 +710,19 @@ else
 
     [[ "${IDENT}" ]] && IDENT="${IDENT}:"
 
-    # If we are root, show that in red
-
     if [[ ${USER} == "root" ]]; then
+        # If we are root, show that in red
         PS1="\[${VT_RED_BG}${VT_WHITE_FG}\]${IDENT}\w\[${VT_RESET}\] "
     else
-        PS1="\[${VT_WHITE_BG}${VT_BLACK_FG}\]${IDENT}\w\[${VT_RESET}\] "
+        if [[ $(\grep QEMU /proc/cpuinfo) ]]; then
+            # If we are in a qemu virtual machine, in yellow
+            PS1="\[${VT_YELLOW_BG}${VT_BLACK_FG}\]${IDENT}\w\[${VT_RESET}\] "
+        else
+            # Otherwise in white
+            PS1="\[${VT_WHITE_BG}${VT_BLACK_FG}\]${IDENT}\w\[${VT_RESET}\] "
+        fi
     fi
 
-    # In an xterm, show the hostname and path in the title bar, highlight
-    # the prompt
-
-    # [[ "${TERMS_WITH_BAR}" ]] || TERMS_WITH_BAR="^xterm|screen$"
-
-    # if [[ "${TERM}" =~ "${TERMS_WITH_BAR}" ]]; then
-    # PS1="\[${VT_SET_TITLE}shell@\h (\w)${VT_END_TITLE}${VT_WHITE_BG}\]${IDENT}\w\[${VT_RESET}\] "
-    # else
-    # PS1="\[${VT_WHITE_BG}\]${IDENT}\w\[${VT_RESET}\] "
-    # fi
-
 fi
 
 ######################################################################