Sample Header Ad - 728x90

Get the Absolute Path from feh

2 votes
2 answers
1031 views
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
Asked by Lonnie Best (5415 rep)
Jan 3, 2022, 11:10 AM
Last activity: Nov 5, 2022, 09:17 PM