PDA

View Full Version : Checking your .sh script for Bashisms


rbelk
March 18th, 2009, 09:35
I posted a tutorial on my site about checking your .sh scripts for bashisms. Here's the link Bashisms (http://blog.rylos.co.cc/2009/03/checking-script-for-bashisms-on-freebsd.html). Test it out to see if it works for yourself, any comments are welcome.

vermaden
March 18th, 2009, 11:17
If you script works properly at FreeBSD or Solaris /bin/sh you do not need any further tools to confirm that ;)

Also avoiding linuxism page from FreeBSD WIKI:
http://wiki.freebsd.org/AvoidingLinuxisms

The checkbashisms also sometimes reports false alarms:
~/DEVSCRIPTS/usr/bin$ ./checkbashisms ~/scripts/vergallery.sh
possible bashism in ~/scripts/vergallery.sh line 265 ($SECONDS):
RESOLUTION="${MINUTES}:${SECONDS}"

while this line is 100% POSIX sh compatible.