Make script rtems-bsps compatible with GNU find

Pavel Pisa pisa at cmp.felk.cvut.cz
Mon Dec 14 13:11:48 UTC 2015


Hello Chris and others,

the depth argument changes order of find output only
according to GNU find manual

   -depth Process  each  directory's  contents before the directory
    itself.  The -delete action also implies -depth.


The following value 5 is then considered as path argument
but for GNU find such argument are illegal after the first
filter option. maxdepth is the right argument for GNU find
for intended limitation

   -maxdepth levels
    Descend at most levels (a non-negative integer) levels of directories
    below the command line arguments.  -maxdepth 0
    means only apply the tests and actions to the command line arguments.

If the -maxdepth is accepted by your/others BSD, OS X, Cygwin
finds flavors then next change would make script to run on Linux.

Best wishes,

              Pavel


diff --git a/rtems-bsps b/rtems-bsps
index 173c438..f322fe4 100755
--- a/rtems-bsps
+++ b/rtems-bsps
@@ -5,7 +5,7 @@ base_e=$(echo ${base} | sed -e 's/\//\\\//g')

 last_arch=""

-cfg_list=$(LANG=C LC_COLLATE=C find ${base} -name \*.cfg -depth 5 | sort)
+cfg_list=$(LANG=C LC_COLLATE=C find ${base} -maxdepth 5 -name \*.cfg | sort)

 max_bsp_len=0
 arch_count=0



More information about the devel mailing list