效果:
实现步骤
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