Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Prompt dir expansion after removing cwd's parent



On Wed, Jun 8, 2022 at 9:15 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> If you're doing this to
> yourself often enough to notice, put something in your precmd hooks to
> discover it.

SGI IRIX (y'all have seen Jurassic Park, ya?) had this thing called
FAM, the File Access Monitor.  Here's a really dumb version of that.

# --- 8< --- zFAM
# Example Usage
#    coproc zFAM
#    chpwd() { pwd -P >&p }
#    precmd() { read -t 0 -p && print -ru2 -- $REPLY not readable }

typeset filename
read filename    # Wait forever for first file to monitor

while [[ -n $filename ]]
do
    if [[ -r $filename ]]
    then
      read -t 1 filename
    else
      print -r -- $filename
      read filename
    fi
done
# --- >8 ---




Messages sorted by: Reverse Date, Date, Thread, Author