iankelling.org
/
git
/
distro-setup
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
lots: shellcheck, streaming stuff, fixes
[distro-setup]
/
clip-sad
1
#!/bin/bash
2
set -e
;
.
/
usr
/
local
/
lib
/
bash-bear
;
set
+
e
3
cd
/
a
/
bin
/
data
/
clips
/
sad
4
5
if
pgrep mpv
;
then
6
pkill mpv
7
exit
0
8
fi
9
10
clip
=
$
(
find
.
-type
f
-printf
'%f
\n
'
| \
11
{
if
[[
-e
/
tmp
/
last-sad
]];
then
12
sed
"/^$(cat /tmp/last-sad)\$/d"
13
else
14
cat
15
fi
; }
| \
16
shuf |
head
-n1
)
17
echo
$clip
>/
tmp
/
last-sad
18
mpv
--profile
=
a
$clip