0

I'm writing my own bash script and I have some troubles with UTF8 characters in filename.

I have file with name: ../ahh/Nový textový dokument.txt

I get this error:

cat: '"../ahh/Nov\303\275 textov\303\275 dokument.txt"': No such file or directory

For others script works fine.

Fragment of my bash script:

git status -su | tr \\r \\n | while read -r line ;
do
    FILE=$(echo "$line" | awk '{$1 = ""; print substr($0,2)}')
    cat "$FILE"
done
Cyrus
  • 84,225
  • 14
  • 89
  • 153

1 Answers1

1

If you do git status or git ls-files you may get something like:

$ git status 
A  "Nov\303\275 textov\303\275 dokument.txt"

This is because by default git print non-ASCII filenames in quoted octal notation, this can be disabled for the current repository with:

git config core.quotepath off

Then:

$ git status -s
A  "Nový textový dokument.txt"

Check this answer for more details: https://stackoverflow.com/a/22828826/1135424

nbari
  • 25,603
  • 10
  • 76
  • 131