Software, audio, and other musings.

Smarter Bash Scripts

April 4, 2017

Recently I was looking at my blog, working on some design changes and I was on this article. I noticed that I wrote a small shell script for initializing Composer with the HHVM.

The script I provided looked something like this:

#!/usr/bin/env bash
hhvm /usr/local/bin/composer $@

I noticed that I can make this a bit more portable. Notably, I am calling where I put the Composer .phar file explicitly in my file system. This may not be where you have it.

#!/usr/bin/env bash
COMPOSER=`which composer`
hhvm $COMPOSER $@

There, now it should work in more places.

To Top