17 lines
483 B
Bash
Executable file
17 lines
483 B
Bash
Executable file
#!/bin/sh
|
|
|
|
tmpfile=$(mktemp /tmp/st-cmd-output.XXXXXX)
|
|
|
|
trap 'rm "$tmpfile"' 0 1 15
|
|
sed -n "w $tmpfile"
|
|
sed -i 's/\x0//g; /^\s*$/d' "$tmpfile"
|
|
|
|
from="$(nl -w2 -s' ' <"$tmpfile" | dmenu -p 'From:' | awk '{print $1}')"
|
|
to="$(nl -w2 -s' ' <"$tmpfile" | dmenu -p 'To:' | awk '{print $1}')"
|
|
|
|
if [ "$to" -lt "$from" ]; then
|
|
notify-send "Bad range" "${from} > ${to} condinion has been met. Invalid range."
|
|
exit 1
|
|
fi
|
|
|
|
sed -n "${from},${to} p" "$tmpfile" | xclip -selection clipboard
|