You could look into using find: find / -name $1 or you could try doing it by piping it to grep: find / | grep "$1" , but in order for you to make it go from shallowest to deepest, you might have to do something with sort, such as piping the data to it: find / | grep "$1" | sort -g. As for only going 5 levels deep, and printing errors if not found, you are probably bound to rely on awk and/or sed.
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Offline 2,413 posts
since Dec 2004