aboutsummaryrefslogtreecommitdiff
path: root/old/dmenu-filepicker-old
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xold/dmenu-filepicker-old31
1 files changed, 31 insertions, 0 deletions
diff --git a/old/dmenu-filepicker-old b/old/dmenu-filepicker-old
new file mode 100755
index 0000000..532fb82
--- /dev/null
+++ b/old/dmenu-filepicker-old
@@ -0,0 +1,31 @@
1#!/bin/sh
2
3# A dmenu-based file picker (prints selected file to stdout)
4# Requires: dmenu (or similar)
5# Usage: dmenu-filepicker [path]
6
7menu=${MENU:-dmenu}
8menuopts="-i -l 15"
9
10basedir="$(pwd)"
11
12next="${@:-$(pwd)}"
13
14while true; do
15 if [ -z "$next" ]; then
16 break
17 elif [ "$next" = "." ]; then
18 pwd
19 break
20 elif [ -d "$next" ]; then
21 cd "$next"
22 next=$(ls -a | $menu $menuopts)
23 else
24 echo "$next" | while read line; do
25 echo "$(pwd)/$line"
26 done
27 break
28 fi
29done
30
31cd "$basedir"

Generated with cgit - Back to sebastiano.tronto.net