Skip to content

Instantly share code, notes, and snippets.

@sulami
Last active August 14, 2021 17:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sulami/4169a58f99a7b5ca18bdb80c315528e0 to your computer and use it in GitHub Desktop.
Save sulami/4169a58f99a7b5ca18bdb80c315528e0 to your computer and use it in GitHub Desktop.
Alfred dc RPN Calculator Workflow Script
query=$1
result=$( dc -e "$query pq" 2>&1 | tr -d '\\' | head -1 )
echo '{"items": ['
echo '{"title":'
echo "\"${result}\""
echo ','
echo '"subtitle": "Copy result to clipboard",'
echo '"arg":'
echo "\"${result}\""
echo '}]}'
@sulami
Copy link
Author

sulami commented Apr 1, 2020

Just add a script filter input for a keyword of your choice, paste in this script, connect it to a copy to clipboard output, and you're done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment