Jump to content

Bash result inline?

Recommended Posts

Hi Everybody!


I've been tinkering around with workflows tonight and had trouble finding a working example to show the results of a bash script in the search field.

Does anybody have a good clear example I can work from? 


My current code is very basic:


curl -s https://www.marketwatch.com/investing/stock/aapl |grep '<meta name="price" content="' |cut -d'"' -f4

I've been able to export the results to large text / push notification, but I cannot find the option for inline search result (I hope I'm using the correct terminology)

Link to comment

Welcome @Garevans


For what you want, you need a Script Filter and return either XML or JSON.

For example, in your case the first line is unnecessary (unless you just forgot to insert ${query} in your second line, which seems like it can be the case). Add a Script Filter and make this the code:

value="$(curl -s https://www.marketwatch.com/investing/stock/${query} |grep '<meta name="price" content="' |cut -d'"' -f4)"

cat <<EOF
{"items": [
		"title": "${value}",
		"subtitle": "${query}"

It should work like you want, and require only minor adjustments to your preferences.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...