svn commit: r235005 - head/usr.sbin/pc-sysinstall/backend

Bruce Evans brde at optusnet.com.au
Sat May 5 09:39:19 UTC 2012


On Fri, 4 May 2012, Doug Barton wrote:

> On 05/04/2012 11:22 AM, Baptiste Daroussin wrote:
>>>>>>   fetch -s "${FETCHFILE}" >${SIZEFILE}
>>>>>>   SIZE="`cat ${SIZEFILE}`"
>>>>>> -  SIZE="`expr ${SIZE} / 1024`"
>>>>>> +  SIZE=$((SIZE/1024))
>>>>
>>>> Bug; should be '$SIZE/'
>> No this is perfectly valid
>
> Yes, that works, but it's not our usual style. However, the point is
> moot as that whole block should be reduced down to:
>
> SIZE=$(( `fetch -s "${FETCHFILE}"` / 1024 ))

The KNF rule that there shall be spaces around binary operators should
probably apply in shell expressions too, but I don't like the spaces
on 1 side of (( and )).  Shell syntax doesn't even allow spaces between
'$' ((.

The rc.d style seems to be to use backquotes and not use $(cmd), but I
prefer the opposite except possibly in shell expressions like the above
so that it is easier to separate the commands from the shell expressions.

> If SIZEFILE is needed elsewhere that's a different matter, but as it is
> that's a hot mess.

Bruce


More information about the svn-src-all mailing list