Skip to content

Instantly share code, notes, and snippets.

@alunny
Created April 21, 2011 20:38
Show Gist options
  • Save alunny/935415 to your computer and use it in GitHub Desktop.
Save alunny/935415 to your computer and use it in GitHub Desktop.
# sed in place, for OS X (Darwin) and Linux
# user-agent detection - probably not the best way
DASHI=''
unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then
DASHI="-i"
elif [[ "$unamestr" == 'Darwin' ]]; then
DASHI='-i ""'
fi
echo hello > demo
sed $DASHI 's/l/b/g' demo #hebbo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment