blob: afecbfe56c5074b4be166daca4479a0e31f0b837 (
plain)
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
|
#!/usr/bin/env bash
MNT=/media/swhitton/Kindle
DEST="$HOME/tmp/Kindle notes"
# kindle=$(blkid | awk -F: '/Kindle/ { print $1; exit; }')
filename=$(date +kindle_%F_%H%M.txt)
group=$(groups | awk '{print $1}')
mkdir -p "$DEST"
# sudo umount $kindle
# sudo mount -ouid=$(id -u) $kindle $MNT
if [ -e "$DEST/$filename" ]; then
echo >&2 ERROR: Won\'t clobber other Kindle notes
elif mv --no-clobber \
"$MNT/documents/My Clippings.txt" \
"$DEST/$filename"; then
#chown "$USER:$group" "$DEST/$filename"
# remove the supporting file only if the clippings were moved successfully
rm -rf "$MNT/documents/My Clippings.sdr"
else
echo >&2 ERROR: Couldn\'t move the clippings file: maybe you need to mount \in Thunar
fi
# sudo umount $kindle
|