PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Linux Xmessege Bash Example

Go down

Linux Xmessege Bash Example Empty Linux Xmessege Bash Example

Post by jamied_uk 20th May 2017, 14:42



Example 1:

test.sh


Code:
#!/bin/bash
MESSAGE="Message Test"
#echo "$MESSAGE"
xmessage -center "$MESSAGE"

Code:
sudo chmod +x *.sh

Code:
./test.sh

Example 2:

test.sh


Code:
#!/bin/bash
function show_ip(){
# ip link show
# add path for md5deep to work
#source /etc/profile
a=$(md5deep -q last_ip.txt)
echo -en "Your IP's: \c"
echo ""
echo -n "Your Internal IP Is "
ifconfig enp0s3 | grep "inet addr"| sed 's/addr:/ /' | awk '{print $2}'
# change enp0s3 to eth0 or w.e you need!
echo -n "Your External IP Is "
dig +short myip.opendns.com @resolver1.opendns.com
log_last_ip > last_ip.txt
#md5sum last_ip.txt > last_ip_hash.txt
b=$(md5deep -q last_ip.txt)
[ "$a" = "$b" ] && echo  "IP Not Changed" > out.txt || echo "IP Has Changed Since Last Checked!" > out.txt
# cat out.txt
cat out.txt
espeak -v  en -f out.txt -g 01ms -a 110 -p 58 -s 175
}


MESSAGE="message test"
ip=$('show_ip')
#echo "$MESSAGE"
xmessage -center "$ip"

Code:
./test2.sh
jamied_uk
jamied_uk
Admin

Posts : 2951
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum