Skip to content

Instantly share code, notes, and snippets.

@creamidea
Created March 16, 2016 04:59
Show Gist options
  • Save creamidea/0784194eccc96febbfba to your computer and use it in GitHub Desktop.
Save creamidea/0784194eccc96febbfba to your computer and use it in GitHub Desktop.
调用iTerm,将编码改成gbk
#!/bin/bash
# 使用GBK Profile
echo -e "\033]50;SetProfile=GBK\a"
# 环境编码切换为GBK
export LANG=zh_CN.GBK
export LC_ALL=zh_CN.GBK
# 更改当前 iTerm2 tab title
echo -ne "\033]0;"$@"\007"
$@
echo -ne "\033]0;"${PWD/#$HOME/~}"\007"
# GBK任务完成后,自动切换回默认编码(UTF-8)
echo -e "\033]50;SetProfile=Default\a"
export LANG=zh_CN.UTF-8
export LC_ALL=zh_CN.UTF-8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment