Created
August 10, 2022 02:29
-
-
Save sunnyyoung/fdc8f9af981a643a7536118a9feebe5e to your computer and use it in GitHub Desktop.
Raycast script command: Swap between IP string value and IP integer value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# @raycast.schemaVersion 1 | |
# @raycast.title Swap IP | |
# @raycast.icon 🔢 | |
# @raycast.mode fullOutput | |
# @raycast.argument1 { "type": "text", "placeholder": "IP Value" } | |
if [[ $1 =~ ^-?[0-9]+$ ]] ; then | |
echo $((($1 >> 24) & 0xFF)).$((($1 >> 16) & 0xFF)).$((($1 >> 8) & 0xFF)).$(($1 & 0xFF)) | |
else | |
echo $((16#`printf '%02X' ${1//./ }`)) | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment