lf icon indicating copy to clipboard operation
lf copied to clipboard

How to use $fx for a shell command ?

Open TTtrace opened this issue 2 years ago • 2 comments

Say I just select two files and run $rm $fx, but it reports error:

rm: cannot remove '/home/monottx/test/1.txt'$'\n''/home/monottx/test/2.txt': No such file or directory

I have tried to use " ", "\r" for ifs and filesep option, but none worked.

e.g. If set filesep " ", I would get:

rm: cannot remove '/home/monottx/test/1.txt /home/monottx/test/2.txt': No such file or directory

TTtrace avatar Sep 17 '22 04:09 TTtrace

Did you try set ifs "\n"? It should be the same as filesep for convenience.

lahwaacz avatar Sep 17 '22 06:09 lahwaacz

Did you try set ifs "\n"? It should be the same as filesep for convenience.

I have downloaded the lfrc.example to /etc/lf/lfrc, and its ifs is by default set as "\n". It still cannot work as I expected. In fact, I could tell no difference whether I change its value when I check the output of $fx using $echo $fx.

TTtrace avatar Sep 17 '22 06:09 TTtrace

I'm guessing you use zsh. Zsh does not split words by default. You need to add -y to shellopts. See https://github.com/gokcehan/lf/wiki/Tips#split-words-by-default-in-zsh. This should probably be mentioned in the documentation.

p-ouellette avatar Sep 17 '22 21:09 p-ouellette

I'm guessing you use zsh. Zsh does not split words by default. You need to add -y to shellopts. See https://github.com/gokcehan/lf/wiki/Tips#split-words-by-default-in-zsh. This should probably be mentioned in the documentation.

YES! This helps me out, thank you @p-ouellette very much!

TTtrace avatar Sep 18 '22 12:09 TTtrace

I have the same problem with bash. It only appears when I select more than 1 file and one of the filenames (or more) contains a whitespace.

flashrunnerGH avatar Feb 03 '24 00:02 flashrunnerGH

I've found where is the problem is. IFS is not exported to subshell that is started by typing w. In "internal" shell (after typing $ or %) all works fine. Is it possible to export IFS to subshell?

flashrunnerGH avatar Feb 03 '24 11:02 flashrunnerGH