you are viewing a single comment's thread
view the rest of the comments
[–] 5 points 3 months ago (3 children)

Is this homework of some sort?

By default, GNU ls will quote entries containing certain special or unprintable characters. For example, if a file name contains the space character, GNU ls will print e.g. 'hello world'. This quoting is done using Bash syntax.

In Bash, 'folder'$'\003' (or $'folder\003') represents the text folder followed by octal byte 3. Because you use Fish instead of Bash, this doesn't work­—it has a different syntax to specify unprintable/special characters.

I can tell you how to refer to this file in Fish, but I hesitate to do it if it's for homework. What I will do is point you to the part of the Fish documentation where this is (kind of) explained: in Fish for bash users#Quoting.

  • source
  • hideshow 3 child comments
  • [–] 4 points 3 months ago* (1 child)

    Would it help to use ls --literal --show-control-chars to find out if \003 is indeed the representation of a special character?

  • source
  • parent
  • hideshow 1 child comment
  • [–] 4 points 3 months ago* (last edited 3 months ago)

    The default output itself is pretty definitive, assuming you are indeed using GNU ls and don't have the QUOTING_STYLE environment variable set. https://www.gnu.org/software/coreutils/manual/html_node/Formatting-the-file-names.html explains all this (including your options) and more.

    $ touch $'folder\x03'
    $ ls --quoting-style shell-escape  # the default
    'folder'$'\003'
    $ ls --quoting-style c
    "folder\003"
    $ ls --quoting-style escape
    folder\003
    
  • source
  • parent