Mikolaj Golub wrote: > On Sat, 10 Oct 2009 12:34:05 +0200 (CEST) Alexander Best wrote: > > AB> thanks. this is a cool script and very useful indeed. only thing you > might > AB> want to do is check for root privileges at the beginning to avoid nasty > error > AB> messages like. > > AB> awk: can't open file /var/crash/info.0 > AB> source line number 12 > > In some cases you might not need root privileges. E.g. on some servers I don't > have root but SA gives me read access to crashdumps. In this case if the > script had a check for root privileges I would not be able to use it. > > Actually as for me the message looks informative enough, it says that we have > some problems with accessing crash dump files, so permissions should be > checked. >
Instead of checking for root you could check if the file is readable: if [ -r FILE ] and then print an error message. Although the awk error message is sufficient some people might find this helpful. Regards, Andrew _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"