I am a student and I am trying an excercise that involves assigning a word with quotes, double quotes and other symbols to a file name.
The problem is that I am not getting the expected results.
I am using the scape bar to scape the symbols, but when I list the name of the file this appears with unexpected single quotes at the beginning and the end of the file name and scape bars surrounded by single quotes before the single quotes that are supposed to be part of the file name. This is a bit confusing, I'll show you:
$ echo > \"\\\?\$\*\'\'\*\$\?\\\"
I expect this:
$ ls
"\?$*''*$?\"
but I get this instead:
$ ls
'"\?$*'\'''\''*$?\"'
I've tried to do it in other ways such as wrapping the double quotes in single quotes and viceversa, but I always get the same result. I already had made the same excercise in other computer and it worked perfectly. What is more intriguing is that I've discovered that both the single and the double quote work as a command to redirect to the standard input, what, I suspect, has to do with the unexpected name display:
$ '
>
$ "
>
The commands don't seem to work for anything else than to display the standard input. Is this normal at all? What is going on? What can I do?
ls -N
to print the filename literally ... see https://unix.stackexchange.com/q/258679 – don_crissti Dec 15 '23 at 21:39>
is the continuation prompt... see https://unix.stackexchange.com/q/158997 – don_crissti Dec 15 '23 at 21:49ls
without-N
just tries to quote "problematic" file names as necessary. – Marcus Müller Dec 15 '23 at 21:49ls
version. See Padraig Brady's answer to the question I linked to in my 1st comment... It's also possible that samels
version was aliased tols -N
then yes, it's a matter of configuration... – don_crissti Dec 15 '23 at 21:59