With bash, I am needing to find all gifs in my current directory and subdirectories, and display them in a specific way. I have to include hidden files as well, and I am not allowed to use grep (or its subsidiaries - fgrep and such) or basename. I am running Ubuntu 14.04 through a virtual machine (VirtualBox via Vagrant if that matters) without a GUI. My current script looks like this:
ls -a | find $directory -type f -name "*.gif" | rev | cut -d/ -f1 | rev | cut -d. -f1 | sort -f
This has mostly done what I need, especially with regard to formatting, but when I changed one of the gifs to a hidden file, it was no longer visible - there was an extra empty line, almost as if the file name was written in invisible ink. Does anyone know why it's doing this?