diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2022-07-31 12:02:45 +0200 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2022-07-31 12:02:45 +0200 |
commit | db8b36c89bb56651b11bf34da61bca236472afaa (patch) | |
tree | a96f37f92f32827d24c4618f954dcc8dcec7e37a | |
parent | eaa2430962fe30e729816c10a1dab3b0e971f4e8 (diff) | |
download | scripts-db8b36c89bb56651b11bf34da61bca236472afaa.tar.gz scripts-db8b36c89bb56651b11bf34da61bca236472afaa.zip |
Created dmenuOpen.sh to select a file in a folder and open it.
-rwxr-xr-x | dmenuOpen.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/dmenuOpen.sh b/dmenuOpen.sh new file mode 100755 index 0000000..ff0a839 --- /dev/null +++ b/dmenuOpen.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# dmenuOpen.sh +# +# Selects a file in a folder with dmenu and opens it with rifle + +set -euo pipefail +IFS=$'\n\t' + +folder="$1" +[ -z "$folder" ] && exit 0 + +lines="$(find "$folder" -type f | wc -l)" +selected="$(find "$folder" -type f | grep -o '[^/]*$' | dmenu -l "$lines" -p "File to open: ")" +o "${folder}/${selected}" |