balls icon indicating copy to clipboard operation
balls copied to clipboard

Bashisms

Open singpolyma opened this issue 14 years ago • 6 comments

Are any bash-specific features actually used in this code? I haven't done a full review yet, but so far all I've seen is the [[ ]] syntax, which can always trivially be replaced by POSIX compatible [ ] syntax

singpolyma avatar Jul 19 '11 18:07 singpolyma

While I only contributed review and didn't write any of this, as far as I know it's pretty much just Bourne shell. That stands testing, though.

laughinghan avatar Jul 19 '11 20:07 laughinghan

One thing I rely on heavily is the string manipulation features of bash, for example in the super-hacky trim() function, and in the http-parsing. Is that in vanilla Bourne shell as well?

jneen avatar Jul 19 '11 23:07 jneen

If only there was a test case, so we could just run it through sh.

Also, I just remembered, somewhat relevant, it does depend on a platform specific nc implementation, the one on Darwin (Mac OS X) for example doesn't support -p.

laughinghan avatar Jul 19 '11 23:07 laughinghan

A lot of the string manip things are in standard SH, but a few are bash only. I'll have to look at the code more closely (/test on dash) to see if any of the stuff in here would need to be tweaked.

If you look at my shttpd repo you might find some interesting hacks around nc. I may try to write up an shttpd module for this framework just for kicks.

singpolyma avatar Jul 21 '11 12:07 singpolyma

Beautiful, I'd love to be able to hook this up to shttpd :)

jneen avatar Jul 21 '11 18:07 jneen

Also, some ahem unit tests ahem might be in order.

jneen avatar Jul 21 '11 18:07 jneen