Use zsh aliases to open specefic url

Hi everyone,

Since I have been using a mac I have become quite a fan of zsh (other link).
Now I had a question that I have not yet found an answer to.

We use both Jira and Gitlab for our development.

Now I was wondering if it is possible to create an (firefix) alias that opens a certain link, some of which is static and the rest dynamic

For example:

ja open ticket-105
that opens:
In Firefox

1 Like

Sure :slight_smile:

In ~/.zshrc, add the following:

function ja {
        if [[ "$1" == "open" ]]; then
                open ""$2

Then run source ~/.zshrc to make it effective immediately (without having to log out and log in again).

EDIT: You seem to be on a Mac, so we should probably use open rather then xdg-open.


Works like a charm

1 Like