if [[ -n $(find $path -name "$string*") ]]
then
<stuff>
else
<stuff>
fi
I want to reverse the above search like
if [[ ! -n $(find $path -name "$string*") ]]
then
<stuff>
else
<stuff>
fi
But it wont allow this because here I am checking the find commands output any clue.thanks for help
You can reverse the search in find itself using:
find "$path" ! -name "$string*"
btw this is also valid:
[[ ! -n $(find $path -name "$string*") ]]
Or else you can use -z
:
[[ -z $(find $path -name "$string*") ]]