sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dbdb.sh (743B)


      1 #!/bin/sh
      2 # dmenu-based directory browser
      3 # to run from terminal:
      4 #    source /path/to/dbdb.sh
      5 # or bind it to shortcut:
      6 #   echo bind \'\"\\C-o\":\"source /path/to/dbdb.sh\\n\"\' >> ~/.bashrc
      7 
      8 chosen="placeholder"
      9 
     10 while [ ! -z "$chosen" ]; do
     11     DIRs=$( ls -a1p | grep -P '^\w[^\$/]+/$' | awk -vRS="\n" -vORS="\t" '1')
     12     DOTDs=$( ls -a1p | grep -P '^\.[^\$/]+/$' | awk -vRS="\n" -vORS="\t" '1')
     13     FILEs=$( ls -a1p | grep -P '^\w[^\$/]+$' | awk -vRS="\n" -vORS=" \t" '1')
     14     DOTFs=$( ls -a1p | grep -P '^\.[^\$/]+$' | awk -vRS="\n" -vORS=" \t" '1')
     15     clear && printf "\e[1;7;33m $(pwd) \e[0m\n$FILEs\n\e[0;38;5;238m$DOTFs\e[0m\n"
     16     chosen=`( ( echo -e "$DIRs$DOTDs" | awk -vRS="\t" -vORS="\n" '1' ) | dmenu -i )`
     17 	cd "$chosen"
     18 done