增加分享链接功能
This commit is contained in:
@@ -97,3 +97,22 @@ gen_password() {
|
||||
echo "$rand"
|
||||
}
|
||||
|
||||
# URL编码
|
||||
url_encode() {
|
||||
local str="$1"
|
||||
local encoded=""
|
||||
local i char hex
|
||||
|
||||
for ((i = 0; i < ${#str}; i++)); do
|
||||
char="${str:$i:1}"
|
||||
case "$char" in
|
||||
[a-zA-Z0-9.~_-]) encoded+="$char" ;;
|
||||
*)
|
||||
printf -v hex '%02X' "'$char"
|
||||
encoded+="%$hex"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
echo "$encoded"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user