aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xselectPathFzf.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/selectPathFzf.sh b/selectPathFzf.sh
new file mode 100755
index 0000000..bfe77ad
--- /dev/null
+++ b/selectPathFzf.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Reads a paths file and uses fzf to echo a path.
+# An argument is optional and is used as prompt. A default prompt is used if not provided.
+
+paths="$HOME/.paths"
+[ -z "$1" ] && prompt="Choose a path: " || prompt="$1"
+fzf --prompt "$prompt" <"$paths" | awk '{print $3}'
+