vis-config

lua scripts to configure vis editor

git clone https://9o.is/git/vis-config.git

find-upwards

(304B)


      1 #!/bin/sh
      2 
      3 set -eu
      4 
      5 if [ ! "${1:-}" ]; then
      6     exit 1
      7 fi
      8 
      9 BASEDIR="$(dirname "$1")"
     10 
     11 while read -r glob; do
     12     cd "$BASEDIR"
     13 
     14     while [ "$PWD" != "/" ]; do
     15         set -- "$glob"
     16 
     17         if [ -e "$1" ]; then
     18             echo "$PWD"
     19             exit 0
     20         fi
     21 
     22         cd ..
     23     done
     24 done
     25 
     26 exit 1