I think I have a solution to this, but I'd appreciate links to other documentation or books (paid is fine!) that specifically deal with FreeBSD's sh, because search engines are hopelessly polluted by bash.
What I'm trying to do is check if a FreeBSD version is higher than a specific number via a makefile, which I decided to do in shell (possibly a mistake, awk might be easier). My solution so far is :
It's not incredibly well documented though, and rather confusing, because > can be used when doing arithmetic operations inside (()) but not inside if, where it needs -gt. -gt appears to be documented here
man.freebsd.org
but it's not in the sh man page. If I do a man 1 if it just takes me to builtin. Not to mention that shell in general and 'if' in particular are incredibly fussy about white space.
Am I missing a particularly obvious guide, or link?
What I'm trying to do is check if a FreeBSD version is higher than a specific number via a makefile, which I decided to do in shell (possibly a mistake, awk might be easier). My solution so far is :
Code:
vernum=`uname -r`
vrdigit=${vernum%%.*}
vrdnum=$((vrdigit))
if [ $vrdnum -gt 10 ]; then
..etc
if(1)
but it's not in the sh man page. If I do a man 1 if it just takes me to builtin. Not to mention that shell in general and 'if' in particular are incredibly fussy about white space.
Am I missing a particularly obvious guide, or link?