add copy-public-url.sh
This commit is contained in:
parent
85d3134481
commit
a871ec1447
4 changed files with 28 additions and 6 deletions
12
scripts/copy-public-url.sh
Executable file
12
scripts/copy-public-url.sh
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
str_path="$1"
|
||||
search="asakiyuki@server.asakiyuki.com:15523/home/asakiyuki/PUBLIC/"
|
||||
|
||||
prefix=${str_path%%"$search"*}
|
||||
prefix_index=${#prefix}
|
||||
|
||||
if [ $(expr length "$str_path") -gt $prefix_index ]; then
|
||||
prefix_index=$(($prefix_index + $(expr length $search)))
|
||||
output=${str_path:prefix_index}
|
||||
wl-copy "https://static.asakiyuki.com/${output// /"%20"}"
|
||||
fi
|
||||
Reference in a new issue