Re: realpath quoting
On Fri, May 03, 2024 at 12:31:13PM +0800, jeremy ardley wrote:
> My use case is very simple. Give an argument to a program that expects a
> single filename/path.
Then you need to use "$1" with quotes when you reference it. Simple!
> If you give it an unquoted and unescaped filename it will break parsing the
> args thinking there are many.
Ahhh! You're not even in the script yet. You're having trouble *passing
the filename as an argument* from your interactive shell.
The best way to do this is to use tab completion. The shell should
automatically quote the filename for you, using backslashes.
> When invoking from bash with auto completion the filename will get escaped
> as required. When cutting and pasting into a debugger prompt for args, not
> so.
Ahhh! The question changed a second time!
I have no idea what you think the shell, or the debugger, should do
about this case.
I would suggest that if you need to use a debugger to track down a bug
in your program, you should use filenames that don't require quoting
when you set up your tests.
Reply to: