Jump to content

workflow: bash script that calls redcarpet


Recommended Posts

Hi.

 

I have a script which echos stuff into an html file and then renders markdown there. It works when called from the terminal. When called in a Alfred workflow however, the echo commands work – the redcarpet command doesn't.

 

I suspect it might have to do with me using rbenv and the enviroment not being accessible in the workflow, but am not fluent enough to debug this.

 

Here is the workflow:

#!/bin/bash

f=~/projects/filtercake/linklist.md
t=`mktemp /tmp/alfred_prepend.XXXXXXXX`
q={query}
d=`date +%Y-%m-%d`
e="- "$q"    ["$d"]"

cat - $f <<< $e > $t
mv $t $f
rm $t

~/projects/filtercake/render-linklist

And here is the script:

#!/bin/bash

cd ~/projects/filtercake

touch bookmarks.html
echo "---" > bookmarks.html
echo "layout: default" >> bookmarks.html
echo "title: bookmarks" >> bookmarks.html
echo "---" >> bookmarks.html
echo " " >> bookmarks.html

echo "<h1>Bookmarks</h1>" >> bookmarks.html

redcarpet linklist.md >> bookmarks.html

The workflow is here: https://dl.dropboxusercontent.com/u/2146484/bookmark.alfredworkflow

 

Any help would be much appreciated...

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...