sh man page ....
William A. Mahaffey III
wam at hiwaay.net
Sat Oct 11 00:03:56 UTC 2014
On 10/10/14 12:38, RW wrote:
> On Fri, 10 Oct 2014 10:30:19 -0500
> William A. Mahaffey III wrote:
>
>>
>> I have a FBSD 9.3 desktop that supplanted a Linux FC14 desktop used
>> for web access, some light development, & other day-to-day tasks
>> (i.e. my daily driver, so to speak). I had a bunch of shell scripts
>> written to use Linux sh, which was in fact bash, which means it had a
>> superset of the arithmetic operators that traditional sh had. When I
>> use these scripts under sh under FBSD 9.3, they largely work, though
>> there are some minor differences (empty strings evaluate to zero (0)
>> under bash, error under sh).
> Can you give an example?
>
> $ sh
> $ echo $((1+c))
> 1
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>
Straight out of the script which is failing. Under linux, if I call the
script w/ no '-s #' option, the variable 'slept' is not set, & linux (or
more accurately linux bash) evaluates that to the value oif zero (0).
[wam at kabini1, ~, 7:07:22pm] 386 % sh
$ if [ 0 -lt $(($slept)) ] ; then echo -n "$cmd: sleeping $slept secs
...." ; sleep $(($slept)) ; echo " done." ; fi
arithmetic expression: expecting primary: ""
[wam at kabini1, ~, 7:07:45pm] 387 %
--
William A. Mahaffey III
----------------------------------------------------------------------
"The M1 Garand is without doubt the finest implement of war
ever devised by man."
-- Gen. George S. Patton Jr.
More information about the freebsd-questions
mailing list