Warning using 'find'.


 
Thread Tools Search this Thread
Operating Systems OS X (Apple) Warning using 'find'.
# 1  
Old 11-08-2016
Warning using 'find'.

This is more of a discovery than a bug and for OSX 10.12.x, maybe earlier but I don't have them now.

Consider this code:-
Code:
		# Auto-find the correct path and "sox" file, but it WILL take a very long time...
		# NOTE: It searches from YOUR HOME directory structure only, just modify to suit your machine if 'SOX' is elsewhere.
		capturepath=$(find "$HOME" -name 'sox' 2>/dev/null)

This works perfectly with a virgin install of SOX, (in this case inside my $HOME directory).
I decided to install the latest version of SOX 14.4.2.
I then placed the original into the "Trash", that is "$HOME"/.Trash/ directory.
Next I launched "./AudioScope.sh" and as expected DEMO worked perfectly.
THEN; I decided to run the SOX command inside the code and the code literally crashed out.
The error report pointed to "$HOME/.Trash/sox-14.4.0/sox" so it looks as though the 'find' command searches the "$HOME"/.Trash/ directory also.
Unlike the AMIGA, OSX cannot run code from inside its Trashcan hence the total crashout.
So let this be a warning to others if you have a previous version of something in the Trashcan and another version elsewhere and you intend to find it using the 'find' command then EXPECT a bug as "$HOME"/.Trash/ is searched early in the scan.

I hope this is useful to others.

Bazza...
# 2  
Old 11-11-2016
Just exclude the .Trash directory in your find statement.
Code:
find "$HOME" -path '*.Trash*' -prune -o \( -name sox -print \)

This User Gave Thanks to xbin For This Post:
# 3  
Old 11-11-2016
Get used to the following, that will skip "hidden" directories like .Trash/ .git/ .snapshot/ .Wastebasket/ ...
Code:
find "$HOME" -type d -name '.?*' -prune -o -type f -name 'sox' -print

Note the -print is important. Otherwise it defaults to also print the pruned directories!
These 2 Users Gave Thanks to MadeInGermany For This Post:
# 4  
Old 11-13-2016
Thanks guys.

Will update code soon...

I never guessed that the '.Trash' folder would be searched...
# 5  
Old 11-16-2016
Hi MadeInGermany...

Many thanks the code works superbly...

I have acknowledged your input inside the Manual section of AudioScope.sh...

<Thumbs Up sign here...>
# 6  
Old 11-16-2016
Try character sequence :b: in your post.

Smilie



Kind regards,
Robin
This User Gave Thanks to rbatte1 For This Post:
# 7  
Old 03-25-2017
Quote:
Originally Posted by MadeInGermany
Get used to the following, that will skip "hidden" directories like .Trash/ .git/ .snapshot/ .Wastebasket/ ...
Code:
find "$HOME" -type d -name '.?*' -prune -o -type f -name 'sox' -print

Note the -print is important. Otherwise it defaults to also print the pruned directories!
but you will stuff if it's buried in a places like .cpan .R .conda
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find command giving incomplete sentence warning

Hi , I am adding a line in my shell scripts to delete all the old directory with the below command. On running this command it is coming out with the message find: incomplete statement find /ersdg3/ERS/ERS_INPUT_LOGS/RIO/rio_archive -type d -mtime +47 -exec rm -rf {} What is wrong or... (3 Replies)
Discussion started by: guddu_12
3 Replies

2. Solaris

Jumpstart -- Warning: Could not find matching rule in rules.ok

I just setup a new jumpstart server, and I'm having problems with rules.ok errors. I'm coming up blank after many Google searches, forum searches, etc..... This is the error I receive: Skipped interface e1000g1 Attempting to configure interface e1000g0... Configured interface e1000g0... (0 Replies)
Discussion started by: christr
0 Replies
Login or Register to Ask a Question