1

I'm trying to run the command:

$ sudo echo ko_KR.UTF-8 UTF-8 >> /etc/locale.gen

but I get permission denied. Strangely, it doesn't even ask for my password with sudo.

However, if I type

$ su
# echo ko_KR.UTF-8 UTF-8 >> /etc/locale.gen

It works.

I've tried this on two Manjaro installations - same problem. While the su method works, I'm trying to write a guide so I want to keep it simple.

Does anyone know what I'm doing wrong? It seems like I'm doing some unintended bash syntax.

Thanks!

Dr-Bracket
  • 377
  • 1
  • 5
  • 21

1 Answers1

1

Figured it out -

The shell does the piping, not the process. sudo echo doesn't give bash the privileges to edit /etc. Here's a workaround I found:

echo ko_KR.UTF-8 UTF-8 | sudo tee -a /etc/locale.gen

Now I'm feeding the output of echo into something with sudo privileges (tee) which simply writes to the file.

If anyone finds a simpler way of doing this I'll mark that as the correct answer instead :)

Dr-Bracket
  • 377
  • 1
  • 5
  • 21