sxyazi / yazi

💥 Blazing fast terminal file manager written in Rust, based on async I/O.

Home Page:https://yazi-rs.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using shell command did not escape spaces in the path

178me opened this issue · comments

What system are you running Yazi on?

Linux Wayland

What terminal are you running Yazi in?

alacritty 0.13.2 (bb8ea18e)

Did you try the latest code to see if this problem got fixed?

Tried, but the problem still

yazi --debug output

Yazi
Version: 0.2.5 (Arch Linux 2024-04-27)
OS: linux-x86_64 (unix)
Debug: false

Emulator
Emulator.via_env: ("xterm-256color", "")
Emulator.via_csi: Ok(Unknown([]))
Emulator.detect: Unknown([])

Adaptor
Adaptor.matches: Wayland

Desktop
XDG_SESSION_TYPE: Some("wayland")
WAYLAND_DISPLAY: Some("wayland-0")
DISPLAY: Some(":1")

SSH
shared.in_ssh_connection: false

WSL
/proc/sys/fs/binfmt_misc/WSLInterop: false

Variables
SHELL: Some("/usr/bin/zsh")
EDITOR: Some("nvim")
ZELLIJ_SESSION_NAME: None
YAZI_FILE_ONE: None
YAZI_CONFIG_HOME: None

file(1)
Version: Ok(Output { status: ExitStatus(unix_wait_status(0)), stdout: "file-5.45\nmagic file from /usr/share/file/misc/magic\nseccomp support included\n", stderr: "" })

Text Opener
default: Some(Opener { run: "${EDITOR:=vi} "$@"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })
block: Some(Opener { run: "${EDITOR:=vi} "$@"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })

tmux
TMUX: false

Ueberzug++
Version: Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })

Describe the bug

When I use shell commands to customize shortcut keys

{ on = [ "D" ], run = 'shell "trash-put $@" --confirm', desc = "Permanently delete the files" }

Cannot execute properly when there are spaces in '$@'

I would like to know how to escape or perform other operations

Expected Behavior

Able to correctly escape spaces in the path and execute commands

To Reproduce

{ on = [ "D" ], run = 'shell "trash-put $@" --confirm', desc = "Permanently delete the files" }`

Configuration

No response

Anything else?

No response

You should use "$@" instead of $@ since the latter won't escape special characters in filenames, https://stackoverflow.com/questions/3898665/what-is-in-bash

run = '''shell 'trash-put "$@"' --confirm'''

Closing as this is expected behavior.

You should use "$@" instead of $@ since the latter won't escape special characters in filenames, https://stackoverflow.com/questions/3898665/what-is-in-bash您应该使用 "$@" 而不是 $@ 因为后者不会转义文件名中的特殊字符,https://stackoverflow.com/questions/3898665/what-is-in-bash

run = '''shell 'trash-put "$@"' --confirm'''

Closing as this is expected behavior.关闭是预期行为。

So that's the usage, I understand. Thank you

I'm going to lock this issue because it has been closed for 30 days. ⏳
This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.