How to resolve when the find command returns different exit status code between Solaris 9 (and earlier) and Solaris 10

(Doc ID 1019769.1)

Last updated on JULY 31, 2012

Applies to:

Solaris SPARC Operating System - Version: 8.0 and later   [Release: 8.0 and later ]
All Platforms


How to resolve find(1) returns different exit status code between Solaris 9 Operating System (and earlier) and Solaris 10 Operating System.

To see the different, you can use the following testcase.

1) Prepare 2000 files(a.1, a.2, ..., a.1000, b.1, b.2, ..., b.1000) under "test" directory.


2) Open two terminal windows, and run the following find(1) commands at the same time.

terminal_1# find test -name a\* mv {} test1 \;
terminal_2# find test -name b\* mv {} test1 \;

On Solaris 10, find(1) return 1.

terminal_2# /usr/bin/find test -name b\* -exec mv {} test1 \;
/usr/bin/find: stat() error test/a.118: No such file or directory
terminal_2# echo $?
1                    <----- exit status

However, on Solaris 9 and earlier, find(1) returns 0.

This article explains why this difference happens.


Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms