From: Ian Kelling Date: Wed, 4 Jun 2014 05:27:48 +0000 (-0700) Subject: make hl work if hist files dont exist yet X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=commitdiff_plain;h=156074455caf521f9b6e59685c0fdd0c7f80bc00 make hl work if hist files dont exist yet --- diff --git a/.bashrc b/.bashrc index b8b2861..287b148 100644 --- a/.bashrc +++ b/.bashrc @@ -66,6 +66,7 @@ export GLOBIGNORE=. # still broken in wheezy # still buggered in latest stable from the web, version 2.1 # perhaps its fixed in newer git version, which fails to make for me +# this note is from 6-2014 #shopt -s nullglob # make tab on an empty line do nothing @@ -369,6 +370,10 @@ i() { complete -o bashdefault -o default -o nospace -F _git i 2>/dev/null \ || complete -o default -o nospace -F _git i +# fast commit +ic() { + git commit -am "$*" +} # insensitive find ifn () { @@ -377,6 +382,7 @@ ifn () { + l() { if [[ $PWD == /[iap] ]]; then command ls -A --color=auto -I lost+found "$@" @@ -756,8 +762,9 @@ hl() { # history limit. Write extra history to archive file. local max_lines linecount tempfile prune_lines local harchive="${HISTFILE}_archive" for x in "$HISTFILE" "$harchive"; do - if [[ ! $x || ! -w $x || $(stat -c "%u" "$x") != $EUID ]]; then - echo "error in hl: history file $x no good" + [[ -e $x ]] || { touch "$x" && echo "notice from hl(): creating $x"; } + if [[ ! $x || ! -e $x || ! -w $x || $(stat -c "%u" "$x") != $EUID ]]; then + echo "error in hl: history file \$x:$x no good" return 1 fi done