While rummaging through the sh code of freetz I've repeatedly seen the following constructs
and
Both are obviously syntactically correct.
However, the former is overly complex and loads the cpu needlessly. I suggest using
The latter is inconsistent and inconsequent: if the command using the same file as a prerequisite test requires no double quotes then too the test. And if the test requires double quotes then too the file in the subsequent command. And I suggest
Concurrently, a rule-of-thumb for curly bracing environment variables should also be established. I suggest curly bracing env vars when they are adjacent to characters not in the default IFS definition.
Additionally, I would like to suggest using the following link as a basis for sh coding style. This is mostly inline with sh coding style in practice.
Thank you for reading this post and please do not take this critical insight personally
Code:
cat /mod/etc/reg/cgi.reg | grep -v "^$2|" > $TMPFILE
Code:
[ -e "/mod/etc/reg/file.reg" ] || touch /mod/etc/reg/file.reg
[ -r "/mod/etc/default.$package/$package.save" ] && . /mod/etc/default.$package/$package.save
However, the former is overly complex and loads the cpu needlessly. I suggest using
Code:
grep -v "^$2|" /mod/etc/reg/cgi.reg > $TMPFILE
Code:
[ -e /mod/etc/reg/file.reg ] || touch /mod/etc/reg/file.reg
[ -r "/mod/etc/default.$package/$package.save" ] && . "/mod/etc/default.$package/$package.save"
Additionally, I would like to suggest using the following link as a basis for sh coding style. This is mostly inline with sh coding style in practice.
Thank you for reading this post and please do not take this critical insight personally