script using find command.

Hi,:slight_smile:

find /etc /bin /usr/bin /usr/sbin /var/adm \ -name '*.a' \ '!' '(' -user root -o -user daemon -o -user bin -o -user sys -o -user adm -o -user uucp -o -user nuucp -o -user lpd -o -user imnadm -o -user ipsec -o -user ldap -o -user lp -o -user snapp -o -user invscout ')' \ '!' '(' -group system -o -group security -o -group bin -o -group sys -o -group adm -o -group uucp -o -group mail -o -group printq -o -group cron -o -group audit -o -group shutdown -o -group ecs -o -group imnadm -o -group ipsec -o -group ipsec -o -group ldap -o -group lp -o -group haemrm -o -group snapp -o -group hacmp')' \ -ls

ABove is the sequence of commands that I am trying to execute. The problem is , if the find command does not find any *.a file whose owner is one of the system userids which we have mentioned in the comamnd sequence above , then it stops execution with an error message( User does not exist) and does not get further.Ideally we want the command sequence above to dispaly those *.a files which are owned by general userids other than the system userids mentioned above.Is there any way of ignoring this error message to continue the execution till the end .?

Thanks in advance...:slight_smile:

Please help me..

Please try redirecting all the warnings to infinite sink ...
i.e. "your command" followed by 2>/dev/null

Thanks for your prompt reply. the suggestion you have given me has block the error msg. but the execution of the command sequence it still stoping, i want the entire command sequence to execute without any error message. (The user name does not exist.)

what im trying to say here is , during execution if it encounters a System User which is not therre on the server , the execution must ignore the user and go for the next user included in the command sequence. This is not happening as of now. The command sequence which I am referring to is as follows :

find /etc /bin /usr/bin /usr/sbin /var/adm \ -name '*.a' \ '!' '(' -user root -o -user daemon -o -user bin -o -user sys -o -user adm -o -user uucp -o -user nuucp -o -user lpd -o -user imnadm -o -user ipsec -o -user ldap -o -user lp -o -user snapp -o -user invscout ')' \ '!' '(' -group system -o -group security -o -group bin -o -group sys -o -group adm -o -group uucp -o -group mail -o -group printq -o -group cron -o -group audit -o -group shutdown -o -group ecs -o -group imnadm -o -group ipsec -o -group ipsec -o -group ldap -o -group lp -o -group haemrm -o -group snapp -o -group hacmp')' \ -ls

For eg : If 'sys' user is not found the command sequence should ignore this and check other users which follows .

For all others who might go through this thread , kindly take it up as a challenge , and check if you could crack it. It's an ultimate test of your Unix skills guys . So , kindly work on this and give me your suggestions..!!

Thanks..!!Expecting a lot of responses .. :wink: