Shell
A zsh and bash function that turns an app link into an https link from the terminal, ready to pipe to the clipboard.
- Works on
- macOS and Linux
- Sends
- The app link, to the LinkOpen API. Nothing else.
Add the function
For macOS and Linux. Add the function to ~/.zshrc or ~/.bashrc.
Keep the app link in single quotes so the shell leaves & and ? alone. When piped, the output has no trailing newline, so pbcopy on macOS, or xclip -selection clipboard or wl-copy on Linux, copies just the link.
zsh / bash
# Usage: linkopen 'obsidian://open?vault=Notes&file=Roadmap' [manual]
linkopen() {
local link
link=$(curl -sS -G https://linkopen.app/api/link \
--data-urlencode "url=$1" \
--data-urlencode "mode=${2:-auto}") || return 1
case "$link" in
https://*) ;;
*) echo "linkopen: $link" >&2; return 1 ;;
esac
if [ -t 1 ]; then echo "$link"; else printf '%s' "$link"; fi
}Usage
linkopen 'obsidian://open?vault=Notes&file=Roadmap'
linkopen 'slack://channel?team=T0001&id=C0001' manual
linkopen 'zoommtg://zoom.us/join?action=join&confno=123456789' | pbcopy