chadbraunduin / markdown.bash

A Markdown interpreter using only traditional Unix tools
182 stars 45 forks source link

sed in OS X ... #1

Closed yannsq closed 10 years ago

yannsq commented 10 years ago

Hi, first, I would like to thank you for this nice script :) I was looking for a simple way to transform Markdown in HTML but did not wanted to rely on lots of tools and your project just fit perfectly. I have one issue although because I tried to use it under OS X and the BSD sed is not exactly like the GNU sed. I've installed gnu-sed through brew and slightly modified your script by adding this:

if [ "${OSTYPE}" = "darwin13" ] then export SED=gsed else export SED=sed fi

and replaced all occurrences of 'sed' by ${SED}. Now I can happily use it under OS X. I'm not a sed expert and thus do not know if some others options could be used instead of installing gnu-sed. Although, I believe that testing that OSTYPE has 'darwin' for prefix would be better and issuing an error message if 'geed' is not installed ... Anyway, just a really small contribution to your work ;)

Best regards, yann.

chadbraunduin commented 10 years ago

Thanks for bringing this to my attention. There are a couple ways to fix this issue.

  1. You could also alias gsed to sed in your .bashrc (not sure if it is called that on a Mac) or at the top of the script. That way you wouldn't have to change all of the command references.
shopt -s expand_aliases
alias sed=gsed
yannsq commented 10 years ago

Hi,

ok, in fact, I’m using your script in a project that is distributed to others colleagues and I wanted it to be easy to use, so asking them to add an alias add friction to the adoption of this project :) I’m already a bit embarrassed by the fact that they have to install gsed. Anyway, thank you for your script and your answer.

Best regards, YS.

Le 13 févr. 2014 à 04:36, Chad Braun-Duin notifications@github.com a écrit :

Thanks for bringing this to my attention. There are a couple ways to fix this issue.

You could also alias gsed to sed in your .bashrc (not sure if it is called that on a Mac) or at the top of the script. That way you wouldn't have to change all of the command references. shopt -s expand_aliases alias sed=gsed — Reply to this email directly or view it on GitHub.

dgmstuart commented 9 years ago

Hi I'm trying to run it on OSX 10.10 and I get a lot of sed: illegal option -- r - I assume this is the same issue?

For those who come after me: the shopt/alias lines described above are commented out in the top of the file: uncomment those and the script works :)

@chadbraunduin does this warrant a note in the README?

chadbraunduin commented 9 years ago

Yes, it does. The README has now updated to include instructions for applying this fix. @dgmstuart, I appreciate the note.

dgmstuart commented 9 years ago

@chadbraunduin awesome :)