Help with gammu script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with gammu script
# 1  
Old 02-19-2014
Help with gammu script

hi my friends,

im trying to send messages from my pc using gammu to several phones by reading the numbers from a .txt file
( i just want that to work by this way , no other solution)!

the gammu command for sending sms:
Code:
sudo echo "something doesnt seem right with the server , pls check" | /usr/bin/gammu --sendsms TEXT 004365085372395 (number)

so i need help to make this into a proplery working code.

i figured out that i should do it via a for break
Code:
for i in `cat tel.txt` ; do echo ..... $i ; done
tel.txt = file where numbers are

code should be quiet simple im just not very good.

thx for help guys )
# 2  
Old 02-19-2014
You could do something like this:

Code:
while read f; do
echo "something, pls check" | gammu --sendsms TEXT $f
done <tel.txt

This User Gave Thanks to maverick72 For This Post:
# 3  
Old 02-20-2014
Quote:
Originally Posted by maverick72
You could do something like this:

Code:
while read f; do
echo "something, pls check" | gammu --sendsms TEXT $f
done <tel.txt

ty man, question, whats the meaning of the
Code:
<

? i dont understand exactly.

cheers
# 4  
Old 02-20-2014
When using a while read you have to feed the loop something. In your case it's the tel.txt text file.

You could also do something like this:

Code:
cat tel.txt | while read f; do
echo "something, pls check" | gammu --sendsms TEXT $f
done

That would also work.
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question