Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #269177

Re: realpath quoting

From Sirius <sirius@trudheim.com>
Newsgroups linux.debian.user
Subject Re: realpath quoting
Date 2024-05-03 13:50 +0200
Message-ID <IzZAl-aMZR-7@gated-at.bofh.it> (permalink)
References (2 earlier) <IzQGJ-aHiZ-3@gated-at.bofh.it> <IzRjr-aHve-1@gated-at.bofh.it> <IzSSd-aIFM-3@gated-at.bofh.it> <IzYXD-aMKP-5@gated-at.bofh.it> <IzZqF-aMWm-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


In days of yore (Fri, 03 May 2024), jeremy ardley thus quoth: 
> 
> On 3/5/24 19:06, Greg Wooledge wrote:
> > 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.
> 
> 1970's style static test cases are not relevant here.
> 
> In the real world...  I download files generated by another system that
> are constantly changing content and with names I don't control.
> 
> My workflow is to download a new file from a remote source and then run my
> processor over it.
> 
> As a necessary consequence I need the fully quoted or escaped file name of
> the new file to feed to the processor/debugger.
> 
> I can obviously add an extra step to the process to convert the new file
> name to something acceptable before processing. However, my question was
> how to avoid that extra step by getting fully quoted filenames to process.

Encase the file-name in single or double quotes. If it contains any kind
of construct that could be expanded by the shell, single quotes.

Consider this example:

$ file=abc
$ echo "$file"
$ echo '$file'

If you copy-paste anywhere, slap single quotes around it by habit and you
will not get taken by surprise by spaces or anything the shell decide
looks like something it can evaluate or expand.

-- 
Kind regards,

/S

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

realpath quoting jeremy ardley <jeremy.ardley@gmail.com> - 2024-05-03 01:10 +0200
  Re: realpath quoting Greg Wooledge <greg@wooledge.org> - 2024-05-03 01:40 +0200
    Re: realpath quoting Greg Wooledge <greg@wooledge.org> - 2024-05-03 01:50 +0200
    Re: realpath quoting jeremy ardley <jeremy.ardley@gmail.com> - 2024-05-03 01:50 +0200
  Re: realpath quoting David Christensen <dpchrist@holgerdanske.com> - 2024-05-03 04:20 +0200
    Re: realpath quoting Greg Wooledge <greg@wooledge.org> - 2024-05-03 04:20 +0200
      Re: realpath quoting Max Nikulin <manikulin@gmail.com> - 2024-05-03 05:00 +0200
        Re: realpath quoting jeremy ardley <jeremy.ardley@gmail.com> - 2024-05-03 06:40 +0200
          Re: realpath quoting Greg Wooledge <greg@wooledge.org> - 2024-05-03 13:10 +0200
            Re: realpath quoting jeremy ardley <jeremy.ardley@gmail.com> - 2024-05-03 13:40 +0200
              Re: realpath quoting Sirius <sirius@trudheim.com> - 2024-05-03 13:50 +0200
              Re: realpath quoting David Christensen <dpchrist@holgerdanske.com> - 2024-05-03 21:20 +0200
          Re: realpath quoting Max Nikulin <manikulin@gmail.com> - 2024-05-03 17:20 +0200
        Re: realpath quoting David Christensen <dpchrist@holgerdanske.com> - 2024-05-03 07:40 +0200
          Re: realpath quoting Tom Browder <tom.browder@gmail.com> - 2024-05-04 15:30 +0200
            Re: realpath quoting Greg Wooledge <greg@wooledge.org> - 2024-05-04 16:00 +0200
      Re: realpath quoting David Christensen <dpchrist@holgerdanske.com> - 2024-05-03 07:20 +0200
        Re: realpath quoting Greg Wooledge <greg@wooledge.org> - 2024-05-03 13:10 +0200
          Re: realpath quoting David Christensen <dpchrist@holgerdanske.com> - 2024-05-03 20:50 +0200
  Re: realpath quoting Teemu Likonen <tlikonen@iki.fi> - 2024-05-03 06:50 +0200

csiph-web