
Hi Stephen,
On 27 January 2014 09:03, Stephen Warren swarren@wwwdotorg.org wrote:
On 01/26/2014 08:41 AM, Simon Glass wrote:
Hi Stephen,
On 23 January 2014 12:56, Stephen Warren <swarren@wwwdotorg.org mailto:swarren@wwwdotorg.org> wrote:
From: Stephen Warren <swarren@nvidia.com <mailto:swarren@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 <sjg@chromium.org mailto:sjg@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)
Given all the parameters, it is bit different from Unix, but test -e <lots of params> sounds like a nice idea.
Regards, Simon