Hi Matthew ! >> [ -f SCRIPTFILE ] && source SCRIPTFILE || error action >> (also -r instead of -f may be used) > >-r is preferable because then your script won't fail if the file is >unreadable
Depends on usage. If the script runs as user root (e.g. as linuxrc on initramfs), every file/device is readable, so you are more likely interested to test if it is a regular file (think of source /dev/zero). If you run scripts as normal user, the readable test may be preferable ... or you tend to use both tests: [ -f SCRIPTFILE -a -r SCRIPTFILE ] && ... will only succeed if it's a readable regular file :) ... but depending on usage this extra text could be overdone (make things slower). >> [For the novice: ". SCRIPTFILE" is same as "source SCRIPTFILE"; just >> an alias syntax] > >I've heard rumors that backticks are discouraged in favor of $( )... >Can we do the same for . in favor of source? You can't exactly grep >for '.' It was just a hint for novices that both syntax forms behave identical and description may be used for both. There was no preference which form shall be used, otherwise you are right. I prefer $() and source within scripts and tend to use backticks and dot on command line. -- Harald _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
