#!/usr/bin/sh # # fuzzel_open_file.sh DIR # # Open file or terminal in current directory. Requires fuzzel and # xdg-open. DIR=${1:-$HOME} cd "$DIR" || exit 1 DIR="$(pwd)" selection=$(ls --group-directories-first -a1v | fuzzel --dmenu --prompt "$ open $DIR/") if [ -n "$selection" ]; then if [ "$selection" = "." ]; then exec $TERMINAL -D "$DIR" elif [ -d "$DIR/$selection" ]; then exec $0 "$DIR/$selection" elif [ -f "$DIR/$selection" ]; then exec open "$DIR/$selection" fi fi