Skip to content

Instantly share code, notes, and snippets.

@brandongalbraith
Created May 22, 2020 14:59
Show Gist options
  • Save brandongalbraith/9ac18674c237cd9440b30150c3b0b283 to your computer and use it in GitHub Desktop.
Save brandongalbraith/9ac18674c237cd9440b30150c3b0b283 to your computer and use it in GitHub Desktop.
Create a .url file on MacOS
# Source: https://superuser.com/questions/689441/how-do-i-create-a-url-file-on-os-x
#!/bin/bash
if [[ $# -le 1 || $# -ge 3 ]] ; then
echo Usage: $0 '<namefile> <url>'
echo
echo Creates '<namefile>.url'.
echo Openning '<namefile>.url' in Finder, under OSX, will open '<url>' in the default browser.
exit 1
fi
file="$1.url"
url=$2
echo '[InternetShortcut]' > "$file"
echo -n 'URL=' >> "$file"
echo $url >> "$file"
#echo 'IconIndex=0' >> "$file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment