-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathshare.spell
More file actions
executable file
·36 lines (35 loc) · 908 Bytes
/
Copy pathshare.spell
File metadata and controls
executable file
·36 lines (35 loc) · 908 Bytes
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
#!/bin/bash
set -e
HOST=mendess@mendess.xyz
while [[ "$#" -gt 0 ]]; do
case "$1" in
-u | --unlisted)
unlisted=1
;;
*)
if [[ "$FILE" ]]; then
filename="$1"
else
FILE="$1"
fi
;;
esac
shift
done
[ "$filename" ] || filename="$(basename "$FILE")"
if [ -d "$FILE" ]; then
zip -r "/tmp/$filename.zip" "$FILE"
FILE="/tmp/$filename.zip"
filename="$filename.zip"
fi
[[ "$unlisted" ]] && filename="unlisted/$filename"
rsync -av "$FILE" "$HOST:vault/basement/blind-eternities/files/$filename"
url="https://mendess.xyz/files/$filename"
if command -v termux-clipboard-set &>/dev/null; then
echo -n "$url" | termux-clipboard-set
elif [[ "$WAYLAND_DISPLAY" ]]; then
echo -n "$url" | wl-copy
elif [[ "$DISPLAY" ]]; then
echo -n "$url" | xclip -sel clip
fi
echo "$url"