一、主题
PROMPT=‘%{$fg[blue]%}[%D %*]${PR_RST} %{$fg[red]%}>%{$fg[yellow]%}>%{$fg[green]%}>${PR_RST} %{$purple%}%n${PR_RST} at %{$orange%}iwm-yyz${PR_RST} in %{$limegreen%}%~${PR_RST} $vcs_info_msg_0_$(virtualenv_info) $ ‘
二、终端工具
# ip查询 i() curl ip.cn/$1 # ctrl+q 退回上层 cdlast() { cd - ls -lrth --color=auto | tail zle reset-prompt } zle -N cdlast bindkey ‘^Q‘ cdlast # 时间戳转换 ds() date -d @$1 "+%Y-%m-%d %H:%M:%S" sd() date -d "$1" +%s # 有道翻译 fanyi() { word=`echo $1 | tr -d ‘\n‘ | xxd -plain | sed ‘s/\(..\)/%\1/g‘` result=$(curl -s "http://fanyi.youdao.com/openapi.do?keyfrom=CoderVar&key=802458398&type=data&doctype=json&version=1.1&q=$word") echo "\033[31m【检索】:\033[0m\c" echo $result | awk -F ‘query":‘ ‘{print $(2)}‘ | awk -F ‘,‘ ‘{print $1}‘ echo "\033[33m【释义】:\033[0m\c" echo $result | awk -F ‘:‘ ‘{print $(2)}‘ | awk -F ‘,‘ ‘{print $1}‘ echo "\033[36m【说明】:\033[0m\c" echo $result | awk -F ‘explains":‘ ‘{print $(2)}‘ | awk -F ‘}‘ ‘{print $1}‘ }
原文地址:https://www.cnblogs.com/onlycat/p/9753799.html
时间: 2024-10-21 02:50:21