I need to write a script that lists all the files with a .gif extension in the current directory and all its sub-directories BUT DO NOT use ANY of:
- basename
- grep
- egrep
- fgrep
- rgrep
- &&
- ||
- ;
- sed
- awk
AND still include hidden files.
I tried find . -type f -name '*.gif' -printf '%f\n'
which will succesfully display .gif files, but still shows extension. Here's the catch: if I try to use cut -d . -f 1
to remove file extension, I also remove hidden files (which I don't want to) because their names start with ".".
Then I turned to use tr -d '.gif'
but some of the files have a 'g' or a '.' in their name.
I also tried to use some of these answers BUT all of them include either basename, sed, awk or use some ";" in their script.
With so many restrictions I really don't know if it's even possible to achieve that but I'm supposed to.
How would you do it?