-1

I want to change name with mv command. The file is inside left and right double quotes. e.g

“My file name.” want to change it to My_file_name

How can can I can escape the special character and . I know about regular double quotes " but somehow cannot find a way to escape the special double quotes.

The way I change the name for now, is with graphical file manager nautilus. I use gnome terminal as terminal emulator.

2 Answers 2

2

As far as I know, left and right double quotes aren't special for bash, so they won't act like normal double quotes ". They don't need to be escaped.

Try surrounding everything with single quotes ' ' as it makes all the content literal.

You issue is probably the spaces in the name, not the quotes.

3
  • Thanks. That was the solution. Now I need to find how to write the left double quote “ character lol
    – llesh
    Commented Dec 27, 2023 at 10:03
  • 1
    You can use wildcards, @llesh Commented Dec 27, 2023 at 10:18
  • You can use kcharselect to get any special character into your clipboard. @llesh
    – td211
    Commented Dec 27, 2023 at 10:43
0

ls *'My file name'* | od -t x1o1ac should show you the filename bytes in hex, octal, ascii name and C notation.

I suspect your quotes are LEFT (and RIGHT) DOUBLE QUOTATION MARK, multibyte in UTF-8 encoding.

You can input arbitrary octal with the $'...' Bash string.

$ echo $'\342\200\234 \342\200\235'
“ ”
$ echo $'\342\200\234 \342\200\235' | od -t x1o1ac
0000000  e2  80  9c  20  e2  80  9d  0a
        342 200 234 040 342 200 235 012
          b nul  fs  sp   b nul  gs  nl
        342 200 234     342 200 235  \n
0000010

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .