在~/.bashrc文件末尾加入以下代码,然后执行source ~/.bashrc
# explain.sh begins
explain () {
if [ "$#" -eq 0 ]; then
while read -p "Command: " cmd; do
curl -G --ciphers ecdhe_ecdsa_aes_128_sha "https://www.mankier.com/api/explain/?cols="$(tput cols) --data-urlencode "q=$cmd"
done
echo "Bye!"
elif [ "$#" -eq 1 ]; then
curl -G --ciphers ecdhe_ecdsa_aes_128_sha "https://www.mankier.com/api/explain/?cols="$(tput cols) --data-urlencode "q=$1"
else
echo "Usage"
echo "explain interactive mode."
echo "explain 'cmd -o | ...' one quoted command to explain it."
fi
}
然后可以用explain命令,使用说明请看官网
https://www.mankier.com/
网友评论