X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=scripts.git;a=blobdiff_plain;f=bashrc;h=1a947db7768d411499b0d38417e84a59bd030f6d;hp=ad114070e9497c890610d4008bf4cf89691beebe;hb=0112da1a38def39a00d6c3d9fbc07a4efb4fb812;hpb=0f23707db99e494a1c69981078ca2489a004c9bb 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 }