scripts/old/feh_browser.sh
2017-02-18 09:32:51 +02:00

26 lines
354 B
Bash
Executable File

#!/bin/bash
shopt -s nullglob
if [[ ! -f $1 ]]; then
echo "$0: first argument is not a file" >&2
exit 1
fi
file=$(basename -- "$1")
dir=$(dirname -- "$1")
arr=()
shift
cd -- "$dir"
echo $file
for i in *; do
[[ -f $i ]] || continue
arr+=("$i")
[[ "$i" == "$file" ]] && c=$((${#arr[@]} - 1))
done
exec feh "$@" -- "${arr[@]:c}" "${arr[@]:0:c}"