[PATCH] Bash script to review BSP File Organization

Ralf Corsepius ralf.corsepius at rtems.org
Thu Sep 19 04:08:39 UTC 2013

On 09/17/2013 08:19 PM, Joel Sherrill wrote:

Some remarks:

>>>> +#! /bin/bash
This should be #!/bin/bash

The need for '#! ' is an urban myth.

>>>> +calling_path=`pwd`
As this is a bash script and not a /bin/sh script, there is not much use 
in using backticks (`cmd`) instead $(cmd).

The latter are much safer (can be nested) and better readable.

These days, backticks are only of importance, when compatibility to 
pre-POSIX /bin/sh is of importance.

>>>> +    egrep " +$" $f >/dev/null
egrep is an anachronism. It's deprecated for a very long time (> 10 
years) and only provided as legacy for backward compatibility.

New code should use grep -E instead.

>>>> -  if [ -r configure.ac ] ; then

>>>> +  if [[ $format -eq "1" ]]; then
Here, both, pre-POSIX and POSIX-style "test" are being used. I'd 
recommend to using only one.

Finally, I am very sure this script has a lot of quoting issues (aka. 
missing ""). Most prominent case for them to show is cases when 
directories are containing whitespaces. RTEMS itself doesn't contain 
such case, but e.g. users with a Windows history, are used to using 
something like "/home/user/my\ work\ files", which often exposes such 
quoting issues.


More information about the devel mailing list