X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=bashrc;h=cb98ffa989b7737ef22149af1ec80ec77853a34a;hb=2ef9154eec1d4732fc9bbad47b66f48854fa3ce6;hp=b7e32623b0486be8937e493793b79c931f936043;hpb=7d0d106afa93fa5dba16c59fad371c94e0f55af3;p=scripts.git diff --git a/bashrc b/bashrc index b7e3262..cb98ffa 100644 --- 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 [ ...]" >&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 ######################################################################