make hl work if hist files dont exist yet
authorIan Kelling <ian@iankelling.org>
Wed, 4 Jun 2014 05:27:48 +0000 (22:27 -0700)
committerIan Kelling <ian@iankelling.org>
Thu, 4 May 2017 23:40:14 +0000 (16:40 -0700)
.bashrc

diff --git a/.bashrc b/.bashrc
index b8b286116ede7d64a5d9a4cac07de4d8aa702e32..287b148e5cdd604fd351eb951d06bafea41bf9d7 100644 (file)
--- 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