On 01/26/2014 08:41 AM, Simon Glass wrote: > Hi Stephen, > > On 23 January 2014 12:56, Stephen Warren <swar...@wwwdotorg.org > <mailto:swar...@wwwdotorg.org>> wrote: > > From: Stephen Warren <swar...@nvidia.com <mailto:swar...@nvidia.com>> > > This could be used in scripts such as: > > if exists mmc 0:1 /boot/boot.scr; then > load mmc 0:1 ${scriptaddr} /boot/boot.scr > source ${scriptaddr} > fi ... > Acked-by: Simon Glass <s...@chromium.org <mailto:s...@chromium.org>> > > Seems useful. > > In addition, if it is just the error messages you are worried about (and > I agree they should be eliminated) I wonder if we should consider adding > a -e flag (or similar) to the read command to make it silently fail when > the file does not exist? Arguably your code fragment above could be: > > if load -e mmc 0:1 ${scriptaddr} /boot/boot.scr; then > source ${scriptaddr} > fi
That would certainly work, although I think a direct check of file-existence is more in line with how a regular Unix shell script would work (test -e). I could imagine wanting to test for the existence of a file without caring about its contents (e.g. using a file as a flag to trigger a firmware upgrade or something) _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot