Welcome to Vifm Q&A, where you can ask questions about Vifm usage. Registration is optional, anonymous posts are moderated. GitHub or Google logins are enabled.
0 votes
in vifm by

Hi, I'd like to iterate over the selected files (%f) in a bash script. I've tried many variants, however, none of these is working if the file names contain spaces, e.g.

#!/bin/bash

files=$1

for file in $files
do
    echo $file
done

splits also each file name at the containing spaces. Called with:

command! iterate iterate.sh "%f"

Does anybody have a working script which can handle also this case? Thank you!

1 Answer

0 votes
by

Hi,

use this in vifm

command! iterate iterate.sh %f

and a script like this

#!/bin/bash

for file; do
    echo "$file"
done
by

Thank you so much, it works!

If you would like to make a bug report or feature request consider using GitHub, SourceForge or e-mail. Posting such things here is acceptable, but this is not a perfect place for them.
...