In DirEd, when I copy a filename, using

C-u 0 w

, it's copied fine, but I can't use this string in a shell command, cause it's not escaped.

Is there a function to convert a string to an escaped string?

1 Answer 1


I can't use this string in a shell command

C-hf shell-quote-argument is the function which performs shell-specific escaping. Any time you're building a shell command programmatically, you should pass variable arguments to that function.

In your interactive dired case, though... surely you want to use ! to run a shell command with the current file (or marked files) as an argument?

See C-hf dired-do-shell-command for details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.