How To Make IoT Messaging with BashShell

Create new file with extension .sh ..
As you know the first line of Bash Script start with this

okay, let's say we want collect information of our IoT like Memory and IP Address etc..
so we can collect this information with Shell Script.

# Get Used Memory
um=$(free -h | grep Mem | awk ' { print $3 } ')
# Get Free Memory
fm=$(free -h | grep Mem | awk ' { print $2 } ')
# Get Local IP Address
ipadd=$(ifconfig wlp3s0b1 | grep 'inet ' | awk '{print $2}')
# Get Public IP Address
Okay We Are Done, We collect all information that we need to save, so we need name for our IoT, let's make it complex .
Now we put all Variables in one Variable
Now let's Save our Data
output=$(curl -X POST $URL)
the output variable should be like this :
New Name
Note it respond with "New Name" and the link of your saved data.
if we save data again the output looks like this :



  1. When you use awk, grep is redundant:

    um=$(free -h | awk '/Mem/ { print $3 }')


Post a Comment

Popular posts from this blog

Byobu : Japanese term for decorative