Hi ! >. nonexistent_file > >is not possible, the script just stops. >there is no trap, which can handle this. >only workaround is to check existence. > >also: i could'nt find any documentation how >it _should_ be handled. the common way of > >. nonexistent_file 2>/dev/null || action > >is not possible.
Have you ever seen the following line in shell scripts? [ -f SCRIPTFILE ] && source SCRIPTFILE || error action (also -r instead of -f may be used) Now ask why it's done this way? -f tests if the file is there and it is a regular file -r tests if there is a readable file or device (checks users permissions) so the simple test allows to detect missing script files and react on this. Or use an IF construct: if [ -f SCRIPTFILE ] then source SCRIPTFILE || script returned not zero else script file is missing fi This is a known issue in Unix shell programming. Several shells exit or fail if you try to source an unavailable (or unreadable) file. So you need to test before doing the source command. [For the novice: ". SCRIPTFILE" is same as "source SCRIPTFILE"; just an alias syntax] -- Harald _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
