Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] Paste with overwrite for multiple files #1747

Closed
TAforever opened this issue Jun 10, 2024 · 5 comments
Closed

[QUESTION] Paste with overwrite for multiple files #1747

TAforever opened this issue Jun 10, 2024 · 5 comments

Comments

@TAforever
Copy link

Hi, can anyone tell me how to edit the paste with overwrite command so that it works for multiple files

    cmd paste-overwrite %{{
             mode=$(head -1 ~/.local/share/lf/files)
             list=$(sed 1d ~/.local/share/lf/files)
             if [ $mode = 'copy' ]; then
                  cp -r $list .
             elif [ $mode = 'move' ]; then
                 mv $list .
             fi
             lf -remote 'send load'
             lf -remote 'send clear'
   }}
@DusanLesan
Copy link

That works fine for me. Do you have ifs set to something? Do you get any errors or it just copies single file or it does nothing? What is minimal configuration to reproduce that issue?

@TAforever
Copy link
Author

I get an error when I try to overwrite files 1 2 and 3

cp: failed to stat '/home/theodor/Downloads/1'$'\n''/home/theodor/Downloads/2'$'\n''/home/theodor/Downloads/3': No such file or directory

@joelim-work
Copy link
Collaborator

I'm guessing word-splitting isn't performed on $list. This can happen if the shell is set to zsh, in which case is it also necessary to add set shellopts '-y'.

@TAforever
Copy link
Author

I'm guessing word-splitting isn't performed on $list. This can happen if the shell is set to zsh, in which case is it also necessary to add set shellopts '-y'.

Thank you for solving the problem, setting the set shellopts '-y' parameter did not help, but changing zsh to bash did

@TAforever
Copy link
Author

TAforever commented Jun 11, 2024

I'm guessing word-splitting isn't performed on $list. This can happen if the shell is set to zsh, in which case is it also necessary to add set shellopts '-y'.

Thank you for solving the problem, setting the set shellopts '-y' parameter did not help, but changing zsh to bash did

The information turned out to be incorrect, I did not notice that I had set shellopts '-eu' and added set shellopts '-y' so your solution turned out to be completely correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants