Clipboard data in shell script

I am fairly new to write shell script. I am trying to execute this macro, but it does not seem to work.

Any clues what I am doing wrong here? This macro is available here if you want to try this out:

Thank you for taking a look!

The issue is probably the single quotes in your second action.

Quoting and interpolation does not work like that. You cannot have the quotes in the clipboard and then expect the $(pbpaste) to return with quotes and the quotes to have meaning to how the words are broken up. The quotes are handled first and then the interpolation happens.

You want no quotes in your second action, and then you want double quotes in your third action.

curl "$(pbpaste)"

Double quotes allow the interpolation of $(pbpaste) within them, while keeping it as a single word for the purposes of the curl command.

1 Like