mirror of
https://github.com/hanzoskill/shorten.git
synced 2026-10-30 21:10:55 +00:00
19 lines
354 B
Bash
19 lines
354 B
Bash
#!/usr/bin/env bash
|
|
|
|
URL="$1"
|
|
|
|
if [ -z "$URL" ]; then
|
|
echo "Usage: shorten <url>"
|
|
exit 1
|
|
fi
|
|
|
|
# Use curl with data-urlencode to handle special characters correctly
|
|
RESULT=$(curl -s -d "format=simple" --data-urlencode "url=$URL" "https://is.gd/create.php")
|
|
|
|
if [[ "$RESULT" == "Error"* ]]; then
|
|
echo "❌ Failed: $RESULT"
|
|
exit 1
|
|
fi
|
|
|
|
echo "$RESULT"
|