Sending Temperature Data (Using LM35) to ThingSpeak Server using ESP8266 (Part 6)

https://www.youtube.com/watch?v=Zdj8N3izTOU
ESP8266 is the new WIFI platform for Internet Of Things (IoT). This module is unbelievably cheap & powerful. ESP modules are available from ESP-1 to ESP12 .

Planeter Intro Cover

https://www.youtube.com/watch?v=peFMqlPkOfk

Machine Learning Bangla Course 1, Part 3 : Machine Learning Example

https://www.youtube.com/watch?v=AzG4gHvyE0U
What is Machine Learning? Machine learning is a field of computer science that uses statistical techniques to give computer systems the ability to

if-then এর ব্যবহার – শেল প্রোগ্রামিং-এ

#!/bin/sh

#count the number of files in current directory, and check if the number is equal to or greater than or less than 26

#NOF represents number of files

NOF=`ls -l | wc -l`

if [ $NOF -eq 26 ]
then
echo “No of files and directories is equal to 26”
fi

if [ $NOF -gt 26 ]
then
echo “No of files is greater than 26”
fi

if [ $NOF -lt 26 ]
then
echo “No of files is less than 26”
fi

exit

শেল প্রোগ্রামিং while লুপ এর উদাহরণ । একটি চার্ট প্রদর্শন করুন

Example Output

bash-3.2$ ./while-loop-example.sh
Enter your Number
10
10 * 1 = 10
10 * 2 = 20
10 * 3 = 30
10 * 4 = 40
10 * 5 = 50
10 * 6 = 60
10 * 7 = 70
10 * 8 = 80
10 * 9 = 90
10 * 10 = 100

The Code

#!/bin/ksh

#example : how to use while loop in shell programming

multiplication()
{

#clear
i=1
while (( i <= 10 )) do echo "$Y * $i = `expr $Y \* $i`" (( i = i + 1 )) done } echo "Enter your Number" read X case "$X" in 1) Y=1 multiplication ;; 2) Y=2 multiplication ;; 3) Y=3 multiplication ;; 4) Y=4 multiplication ;; 5) Y=5 multiplication ;; 6) Y=6 multiplication ;; 7) Y=7 multiplication ;; 8) Y=8 multiplication ;; 9) Y=9 multiplication ;; 10) Y=10 multiplication ;; esac exit

বৃহস্পতিবার এবং শুক্রবারে / etc ফোল্ডারে সমস্ত বিষয়বস্তু /export/home/shell/test/etc.tar তে tar হিসাবে backup করুন

#!/bin/ksh

# on every thursday and friday tar all contents of /etc folder into /export/home/shell/test/. On thursday only create a log file with the list of files
#in the tar file. On thursday untar /export/home/shell/test/etc.tar into vfstab . Then log vfstab exist or not information

DAY=`date +%a`
DATESTAMP=`date +%m-%d-%Y-%H:%M`

if [[ “$DAY” == Mon ]]
then

echo “Today is Monday”

elif [[ “$DAY” == Tue ]]
then

echo “Today is Tuesday”

elif [[ “$DAY” == Wed ]]
then

echo “Today is Wednesday”

elif [[ “$DAY” == Thu ]]
then

echo “Today is Thursday” >> /export/home/shell/test/log/backup-$DATESTAMP.log
cd /etc
tar cvf /export/home/shell/test/etc.tar * >> /export/home/shell/test/log/backup-$DATESTAMP.log
cd /export/home/shell/test
tar xvf etc.tar vfstab

if [[ -f vfstab ]]
then
echo “file vfstab exist” >> /export/home/shell/test/log/backup-$DATESTAMP.log
else
echo “file vfstab does not exist” >> /export/home/shell/test/log/backup-$DATESTAMP.log
fi

elif [[ “$DAY” == Fri ]]
then

echo “Today is Friday”
cd /etc
tar cvf /export/home/shell/test/etc.tar *

elif [[ “$DAY” == Sat ]]
then
echo “Today is Saturday”

else
echo “Today is Sunday”

fi

exit

শেল প্রোগ্রামিং এ if-then-else এর উদাহরণ

#!/bin/sh

#If then else example
#if elif else

NOF=5

if [ $NOF -eq 27 ]

then

echo “No of files and directories = 27”

elif [ $NOF -gt 27 ]

then

echo “No of files are dir are greator than 27”

else

echo “No of files and directories are less than 27”

fi

exit

উদাহরণঃ case এর ব্যবহার। আজকের দিনটির নাম দেখান

bash-3.2$ cat ksh_case_example_1.sh
#!/bin/ksh

#show today’s day name
DAY=`date +%a`

#show value of $DAY
echo $DAY

#based on the value of the DAY variable show the day name in full format
case “$DAY” in

Mon)
echo “Monday”
;;

Tue)
echo “Tuesday”
;;

Wed)
echo “Wednesday”
;;

Thu)
echo “Thursday”
;;

Fri)
echo “Friday”
;;

Sat)
echo “Saturday”
;;

Sun)
echo “Sunday”
;;

esac

—————

Output – ফলাফল

bash-3.2$ ./ksh_case_example_1.sh
Sun
Sunday

For লুপ এর ব্যবহার

bash-3.2$ cat multiplication.sh
#!/bin/bash

# Example use of function/method declaration in Shell Programming
# Example use of for loop

#a function that will multiply 1 to 10 with 5
multiplication()
{
x=5
for i in {1..10}
do
echo $i
echo “the multiplication result is:” $(($i*$x))
done
}

echo “Print 1 to 10; also multiply each number with 5 and show the multiplication result”
multiplication

—————————–
Output – ফলাফল

bash-3.2$ ./multiplication.sh
Print 1 to 10; also multiply each number with 5 and show the multiplication result
1
the multiplication result is: 5
2
the multiplication result is: 10
3
the multiplication result is: 15
4
the multiplication result is: 20
5
the multiplication result is: 25
6
the multiplication result is: 30
7
the multiplication result is: 35
8
the multiplication result is: 40
9
the multiplication result is: 45
10
the multiplication result is: 50

case এর ব্যবহার

Example Output:
10 * 1 = 10
10 * 2 = 20
10 * 3 = 30
10 * 4 = 40
10 * 5 = 50
10 * 6 = 60
10 * 7 = 70
10 * 8 = 80
10 * 9 = 90
10 * 10 = 100

———————————-

#!/bin/bash
multi()
{
clear
for ((i=1;i<=10;i++)); do echo "$Y * $i = `expr $Y \* $i`" done } echo "Enter your Number" read X case "$X" in 1) Y=1 multi ;; 2) Y=2 multi ;; 3) Y=3 multi ;; 4) Y=4 multi ;; 5) Y=5 multi ;; 6) Y=6 multi ;; 7) Y=7 multi ;; 8) Y=8 multi ;; 9) Y=9 multi ;; 10) Y=10 multi ;; esac exit Output 7 * 1 = 7 7 * 2 = 14 7 * 3 = 21 7 * 4 = 28 7 * 5 = 35 7 * 6 = 42 7 * 7 = 49 7 * 8 = 56 7 * 9 = 63 7 * 10 = 70