aboutsummaryrefslogtreecommitdiff
path: root/selectPathFzf.sh
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2019-07-17 16:59:26 +0200
committerInigoGutierrez <inigogf.95@gmail.com>2019-07-17 16:59:26 +0200
commitc2f72222bb24f5d38d9036fb3034a471c1a6d7cc (patch)
tree7b6c94c762f371a30d99a33465c96d90a372adae /selectPathFzf.sh
parent15dc956844ffb5300a47a77f6be8178007430462 (diff)
downloadscripts-c2f72222bb24f5d38d9036fb3034a471c1a6d7cc.tar.gz
scripts-c2f72222bb24f5d38d9036fb3034a471c1a6d7cc.zip
Created script to use .paths file with fzf.
Diffstat (limited to 'selectPathFzf.sh')
-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}'
+