From 1636de73b7e3a3d6bd7cb07901229aee0f1bdc15 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Mon, 27 Jan 2020 23:57:06 +0100 Subject: [PATCH] Merge find/includes, add sort to config.sh --- .scripts/config.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.scripts/config.sh b/.scripts/config.sh index 06801e0..941795f 100755 --- a/.scripts/config.sh +++ b/.scripts/config.sh @@ -34,6 +34,8 @@ pictures # List of files to include INCLUDES=" +Documents/vm/backup/backup.sh +Documents/vm/commands.org dotfiles/dotfiles.sh " @@ -48,18 +50,17 @@ for EXCLUDE in $EXCLUDES; do done EXCLUDE_STRING=${EXCLUDE_STRING%???} - # Find the files -FILES="$(find . \( $EXCLUDE_STRING \) -prune -o -printf '%P\n')" +FILES="$( (find . \( $EXCLUDE_STRING \) -prune -o -printf '%P\n'; echo "$INCLUDES") \ + | grep -vx "" | sort)" # If no name provided if [ -z "$1" ]; then - SELECTED="$(printf "%s\n%s" "$FILES" "$INCLUDES" \ - | uniq | rofi -dmenu -p "Select file to edit")" + SELECTED="$(printf "%s" "$FILES" | rofi -dmenu -p "Select file to edit")" # Else try to search for that file else - SELECTED="$(printf "%s\n%s" "$FILES" "$INCLUDES" | grep "$1" | head -n 1)" + SELECTED="$(printf "%s" "$FILES" | grep "$1" | head -n 1)" fi # Exit if nothing selected