【技外技】在shell登陆的时候随机提供诗词内容用来丰富shell
作者:互联网
效果:
实现步骤
1,编辑文本内容
echo '
#!/bin/bash
data=`curl -s https://v1.jinrishici.com/all.json`
content=`echo $data | jq -r .content`
origin=`echo $data | jq -r .origin`
author=`echo $data | jq -r .author`
echo -e "=====\n\033[0;31m`echo $content && echo ${origin}-${author}`\033[0m\n====="
' > /etc/profile.d/poems.sh
2,安装jq命令
wget https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
mv ./jq-linux64 ./jq
chmodca 755 ./jq
mv ./jq /usr/bin/jq
辅助资源链接:
3,刷新脚本
source /etc/profile.d/motd.sh
标签:origin,技外技,shell,author,诗词,jq,echo,content,data 来源: https://blog.csdn.net/yes_is_ok/article/details/119038948