From: Francois Fleuret Date: Wed, 28 Aug 2013 07:22:04 +0000 (+0200) Subject: Update lsn. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=0112da1a38def39a00d6c3d9fbc07a4efb4fb812;p=scripts.git Update lsn. --- diff --git a/bashrc b/bashrc index ad11407..1a947db 100644 --- a/bashrc +++ b/bashrc @@ -938,17 +938,22 @@ function selector-printer () { # the current directory function lsn () { - LSN_MEMORY=".lsn-mem" - if [[ $1 == "--mem" ]]; then - \ls -p > ${LSN_MEMORY} + LSN_MEMORY=".lsn-state" + if [[ $1 == "--mem" ]] || [[ "$1" == "-m" ]]; then + \ls -pa | sort > ${LSN_MEMORY} + echo "State updated." >&2 + elif [[ -n "$1" ]]; then + echo "lsn [--mem|-m]" >&2 + return 1 else if [[ -f ${LSN_MEMORY} ]]; then - comm -1 -3 ${LSN_MEMORY} <(\ls -p) - comm -2 -3 ${LSN_MEMORY} <(\ls -p) | while read line; do + comm -1 -3 ${LSN_MEMORY} <(\ls -pa | sort) + comm -2 -3 ${LSN_MEMORY} <(\ls -pa | sort) | while read line; do echo "${VT_RED_FG}${VT_BOLD}${line}${VT_RESET} (missing)" done else - echo "No lsn memory here." >&2 + echo "No lsn state here." >&2 + return 1 fi fi }