X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=scripts.git;a=blobdiff_plain;f=bashrc;h=5066b31279fe15c052e62282d8d71c953db6947d;hp=fff96ac3cbaf2f3d9a28b64a1c476e1a8a4cf489;hb=c4d6a634221e8835fc27e3f0f3aded2d7a49a9fd;hpb=d9930e7823c007964a023880587f23db98754eb8 diff --git a/bashrc b/bashrc index fff96ac..5066b31 100644 --- a/bashrc +++ b/bashrc @@ -92,6 +92,10 @@ export LESS_TERMCAP_ue=${VT_RESET} export LESS_TERMCAP_md=${VT_BLUE_FG}${VT_BOLD} export LESS_TERMCAP_me=${VT_RESET} +# I do not like to clutter my home with history files + +export LESSHISTFILE=/dev/null + # export LESS_TERMCAP_md=$'\e[1;34;40m' # This prevents ^S from freezing the shell @@ -117,12 +121,21 @@ alias pd=pushd alias val='valgrind --leak-check=full --show-reachable=yes --db-attach=yes ' alias s='screen -d -R -U && clear' +alias p='feh --force-aliasing -d --full-screen --auto-zoom' function nh () { export HISTFILE=/dev/null unalias cd } +function select-tz () { + # Select a value for TZ + TMP=$(mktemp /tmp/select-tz.XXXXXX) + selector -o "${TMP}" <(grep -v ^# /usr/share/zoneinfo/zone.tab | awk '{print $3}' | sort -u) + cat "${TMP}" + \rm -f "${TMP}" +} + function ding () { if [[ $1 ]] && which winshepherd.sh; then play -q ~/local/sounds/deskbell.wav & @@ -242,6 +255,44 @@ function bak () { done } +function scan () { + n=1 + + while [[ -f "${HOME}/scan-${n}.jpg" ]]; do + n=$((n+1)) + done + + while [[ "$1" ]]; do + if [[ "$1" == "color" ]]; then + OPTS+=" --mode Color" + elif [[ "$1" == "gray" ]]; then + OPTS+=" --mode Gray" + elif [[ "$1" == "a4crop" ]]; then + OPTS+=" -l 5 -t 0 -x 200 -y 290" + else + echo "Unknown argument \`$1'" + fi + shift + done + + echo "**" + echo "** Scanning to ${HOME}/scan-${n}.jpg" + echo "**" + + SCANNER=$(scanimage -L | grep "Canon LiDE 60" | sed -e "s/^.*\`\(.*\)'.*$/\1/") + + scanimage -d ${SCANNER} \ + --format=pnm \ + --mode=color \ + --depth=8 \ + -v \ + --resolution=300 \ + ${OPTS} | \ + convert -rotate 180 - "${HOME}/scan-${n}.jpg" + + echo "** Done". +} + # A password generator function genpw () { @@ -326,9 +377,10 @@ function cdt () { } alias t='cd /tmp' +alias a='cd /tmp/at' function trash () { - TRASH=$(date +/tmp/trash-%Y-%b-%d-%Hh) + TRASH=$(date +/tmp/trash-${USER}-%Y-%b-%d-%Hh) LINK=/tmp/trash mkdir -p ${TRASH} @@ -367,11 +419,9 @@ function pho () { ## A version of date that shows the time at home if TZ is set function dt () { - echo "Local: $(date)" - if [[ ${TZ} ]]; then - local TZ=$(cat /etc/timezone) - echo "Home: $(date)" - fi + echo "Local - $(date)" + unset TZ + echo "Home - $(date)" } ###################################################################### @@ -701,7 +751,9 @@ function mvtoconfig () { export PS1 if [[ "${CONSOLE}" == "yes" ]]; then + PS1="" + else # If the login is a standard one (as specified in @@ -736,6 +788,8 @@ else fi +PS1="${PSCUE}${PS1}" + ###################################################################### # This implements a local history. If we are in a directory containing # a writable local history file, we add the last line of the global @@ -882,6 +936,11 @@ EOF ###################################################################### function prompt_command () { + # if [[ ! "${CORE_CHECK_PWD}" == ${PWD} ]] && [[ $(find . -maxdepth 1 -name "core__*" -print -quit) ]]; then + + [[ "${CORE_CHECK_PWD}" == ${PWD} ]] || find . -maxdepth 1 -name "core__*" + CORE_CHECK_PWD=${PWD} + # if [[ $(umask) != 0022 ]]; then # echo "Umask changed to $(umask)" # fi