/usr/share/doc/bosh/examples/bof is in bosh 0.6-6.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | #!/usr/bin/env bosh
#
# Simple bosh file browser
#
# Keys:
#
# c - change to selected directory
# h - change to home directory
# m - view file
# e - edit file in $EDITOR (falls back to vi)
refresh=1
uservars=1
common{{
function bof_ls {
BOSHVAR1="$PWD"
( [ "$BOSHVAR1" = "/" ] || echo '..'; ls -p1 | grep '/' | tr -d '/') | sed 's/^/[/' | sed 's/$/]/'
ls -p1 | grep -v '/'
BOSHTITLE="$BOSHVAR1"
}
}}
# Main command
command{{
if [ -z "$BOSHVAR1" ]
then
if [ -n "$1" ]
then
if [ -d "$1" ]
then
BOSHVAR1="$1"
else
BOSHERR="bof: directory '$1' does not exist"
return 1
fi
else
BOSHVAR1="."
fi
fi
cd "$BOSHVAR1"
bof_ls
}}
# Pre-action
preaction{{
[ "$BOSHVAR1" = "/" ] && BOSHVAR1=""
f="$BOSHVAR1/$(echo $BOSH | tr -d '[]')"
}}
# Actions:
# chdir
c[.]{{
if [ -d "$f" ]
then
BOSHVAR1="$f"
fi
cd "$BOSHVAR1"
bof_ls
}}
# home
h[.]{{
cd
bof_ls
}}
# more
m[>]{{
cat "$f"
BOSHTITLE="$f"
}}
# edit
e[!]{{
[ -z "$EDITOR" ] && EDITOR=vi
"$EDITOR" "$f"
}}
|