Search code examples
interfacesedawkcygwin

How can I set the interface language of sed, awk etc in Cygwin?


Currently I'm on a Windows XP SP3 machine with English interface language. When I installed the Cygwin and some packages with it, the sed & awk commands are all display in other language, as the following example shown.

$ sed
用法: sed [选项]... {脚本(如果没有其他脚本)} [输入文件]...

  -n, --quiet, --silent
                 取消自动打印模式空间
  -e 脚本, --expression=脚本
                 添加“脚本”到程序的运行列表
  -f 脚本文件, --file=脚本文件
                 添加“脚本文件”到程序的运行列表
  --follow-symlinks
                 直接修改文件时跟随软链接
  -i[扩展名], --in-place[=扩展名]
                 直接修改文件(如果指定扩展名就备份文件)
  -b, --binary
                 以二进制方式打开文件 (回车加换行不做特殊处理)
  -l N, --line-length=N
                 指定“l”命令的换行期望长度
  --posix
                 关闭所有 GNU 扩展
  -r, --regexp-extended
                 在脚本中使用扩展正则表达式
  -s, --separate
                 将输入文件视为各个独立的文件而不是一个长的连续输入
  -u, --unbuffered
                 从输入文件读取最少的数据,更频繁的刷新输出
      --help     打印帮助并退出
      --version  输出版本信息并退出

如果没有 -e, --expression, -f 或 --file 选项,那么第一个非选项参数被视为
sed脚本。其他非选项参数被视为输入文件,如果没有输入文件,那么程序将从标准
输入读取数据。
GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.

How can I make these commands use English language?

Thanks


Solution

  • Cygwin defaults to English even on non-English systems, so something must be setting the Cygwin locale to Chinese. The interface language is determined by the LC_ALL, LC_MESSAGES, and LANG environment variables, in that order of priority. If you're using the mintty terminal, the locale can be set on Text page of its options.