#! /usr/bin/env dash # shellcheck disable=SC2086 # shellcheck source=/dev/null . %SHELL_LIBRARY_PATH tmp=$(mktemp); out=$(mktemp); clean $XDG_CONFIG_HOME/lf/rel_dirs > $tmp; get_hot_key() { printf g if ! [ "$i" = "$(readlink -f "$(cat $tmp | sed -n -e ${a}p)")" ];then printf "%s" "$(basename "$(cat $tmp | sed -n -e ${a}p)" | cut -c 1)"; # i.e. /home/dt/school fi #if ! [ "$(realpath i)" = "$(cat $tmp | sed -n -e ${a}p)" ];then # i = /home/dt/school/informatik printf "%s" "$(basename $i | cut -c 1)"; printf "%s" "$(basename $i | cut -c 2)"; #fi if [ $i = "$(cat $tmp | sed -n -e ${1}p)" ];then printf '.'; fi } for a in $(seq "$(cat $tmp | wc -l )");do echo $a >> $out; while IFS= read -r i;do printf "map %s cd %s\n" "$(get_hot_key "$a")" "$i" >> $out; done < "$(tmp find "$(cat $tmp | sed -n -e ${a}p)" -maxdepth 1)" echo >> $out; done cat $out # | awk '{print $2}' | sort | uniq -d; rm $tmp; rm $out; if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi