How to execute a shell script in the .profiles file All In One
demos
$ cat ./dd-ip-notice-robot.sh
$ cat ./dd-ip-notice-robot.sh
#!/usr/bin/env bash
# coding: utf8
# 自动发送树莓派 ip 地址,到钉钉上
DD_ROBOT_TOKEN=404e996c8747ea4a1230f5cd5f7b2d36006f2732f9111bd3f39ce36d17fa1202
echo $DD_ROBOT_TOKEN
WIFI=$(ifconfig | grep "192.168")
# ✅ $(可执行命令)
# $(ifconfig | grep "192.168" > ip.md)
$(ifconfig | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1' | sed '1 d' > ip.md)
# ✅ read file
RPI_IP=$(cat ./ip.md)
Smbol=$(echo '$')
echo $RPI_IP
MARKDOWN='
{
"msgtype": "markdown",
"markdown": {
"title":"
标签:bin,profile,execute,shell,script,ip,echo,pi,bash
From: https://www.cnblogs.com/xgqfrms/p/17326393.html