The feh command allows you to view images within a folder recursively:
feh --recursive --auto-zoom
While viewing images, it also allows you to associate custom commands with keys 0-9 on your keyboard. For example, if I wanted the terminal to output the filename of the image I was viewing (to the terminal), I could make it do that by pressing the zero key while the image is being displayed by running feh
with an --action
argument like this:
feh --recursive --auto-zoom --action "echo '%f'"
--action
binds the command echo '%f'
to the zero key. %f
is the relative path and looks like this when outputted ./filename.jpg
.
However, I need feh
to give me the absolute path instead of a relative path. So, I need to cut off that dot and then append what's left onto the pwd
.
This is my attempt to do that:
feh --recursive --auto-zoom --cache-size 2048 --action "echo $(pwd)$(echo '%f' | cut -c 2-)}"
but the output looks like this:
/absolute/pathf
(notice the 'f' on the end of the pwd)
How can I instead achieve an output like this? :
/absolute/path/filename.jpg