03-02-2019
Welcome to the forum.
A few comments first:
- Please use code tags to improve readability and understandability of your code and data.
- exercise utmost care when composing your spec: a leading (or missing) slash can make a huge difference in the functioning (or mal-) of your script (here:
/var vs
var)
-
WAY too many spaces. Your code given above will not run.
NO spaces around
= and
/ , and following
$ . Too few around
[ and
] .
When reading your request, my first thought was: a system like that should have hooks (or so) to trigger actions on events like incoming mail. Et voila, from the
project homepage:
Quote:
The program can be run as a SMS daemon which ... can run other external programs or scripts after events like reception of a new message ...
Did you consider that functionality, which is to be preferred over repeatedly listing directory contents?
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Is it possible to send sms to a mobile from unix box using Shell Scripting?
I really wonder if anyone can help me with some information regarding how to setup the environment if possible.
Iam also searching and trying to setup the same.
My Environment:
HP-UX B.11.11 U 9000/800... (2 Replies)
Discussion started by: Omkumar
2 Replies
2. HP-UX
pl. if any one can help me in this .
i wouldlike to know if there is a way to send sms through unix box.
i have tried using mailx option.
but what type of servers will be required .
if any one can give me references...
Thankxs in advance
Regards,
Alpa (1 Reply)
Discussion started by: alpareshamwala
1 Replies
3. UNIX for Dummies Questions & Answers
Hi All
I am newbie with Sendmail and Linux in general. We use sendmail for outgoing and incoming mails.
Once our server receives a certain email xxx@yyy.com we would
like to run a PERL script doing some task wiht it.
Can you address me a little bit on that topic?
In order to do that the... (0 Replies)
Discussion started by: manustone
0 Replies
4. Shell Programming and Scripting
I use the SMS script on this page:
http://www.prescriptionpc.com/TEST_newpage1.html#section=sms
The “functions” work fine, but after clicking “submit” and receiving the
“thank you” message, nothing happens.
I find it odd that I can send a text message to myself choosing my carrier (Virgin... (0 Replies)
Discussion started by: Bruce1969
0 Replies
5. Solaris
I would like assistance on a script that could send a text message to my mobile phone when I run a command and the text should be send only if a condition is met. I want to have a cron-job running every 10 minutes to check the system for overload conditons with a command:
more logfile.log | grep... (5 Replies)
Discussion started by: thinktank
5 Replies
6. Shell Programming and Scripting
Hey guys I was wondering how to go about creating a bash script to send SMS..any ideas are appreciated.. (2 Replies)
Discussion started by: blackzeus
2 Replies
7. Shell Programming and Scripting
Hi ,
I need a script which performs below activity
I have one file named "testfile" in 9 different directories with same name.
I want to perform below action with each testfile of each directory.
if ; then
mv listfiles listfiles_`date +%b%y`
else
echo No Such files
fi
... (4 Replies)
Discussion started by: sv0081493
4 Replies
8. Shell Programming and Scripting
Can anyone please help me to in scripting of sending sms through shell script (1 Reply)
Discussion started by: gargidas15
1 Replies
9. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Write a script checkFiles.sh that takes an arbitrary number of file paths from the command line and carries ... (5 Replies)
Discussion started by: Ezraek
5 Replies
LEARN ABOUT CENTOS
shell-quote
SHELL-QUOTE(1) User Contributed Perl Documentation SHELL-QUOTE(1)
NAME
shell-quote - quote arguments for safe use, unmodified in a shell command
SYNOPSIS
shell-quote [switch]... arg...
DESCRIPTION
shell-quote lets you pass arbitrary strings through the shell so that they won't be changed by the shell. This lets you process commands
or files with embedded white space or shell globbing characters safely. Here are a few examples.
EXAMPLES
ssh preserving args
When running a remote command with ssh, ssh doesn't preserve the separate arguments it receives. It just joins them with spaces and
passes them to "$SHELL -c". This doesn't work as intended:
ssh host touch 'hi there' # fails
It creates 2 files, hi and there. Instead, do this:
cmd=`shell-quote touch 'hi there'`
ssh host "$cmd"
This gives you just 1 file, hi there.
process find output
It's not ordinarily possible to process an arbitrary list of files output by find with a shell script. Anything you put in $IFS to
split up the output could legitimately be in a file's name. Here's how you can do it using shell-quote:
eval set -- `find -type f -print0 | xargs -0 shell-quote --`
debug shell scripts
shell-quote is better than echo for debugging shell scripts.
debug() {
[ -z "$debug" ] || shell-quote "debug:" "$@"
}
With echo you can't tell the difference between "debug 'foo bar'" and "debug foo bar", but with shell-quote you can.
save a command for later
shell-quote can be used to build up a shell command to run later. Say you want the user to be able to give you switches for a command
you're going to run. If you don't want the switches to be re-evaluated by the shell (which is usually a good idea, else there are
things the user can't pass through), you can do something like this:
user_switches=
while [ $# != 0 ]
do
case x$1 in
x--pass-through)
[ $# -gt 1 ] || die "need an argument for $1"
user_switches="$user_switches "`shell-quote -- "$2"`
shift;;
# process other switches
esac
shift
done
# later
eval "shell-quote some-command $user_switches my args"
OPTIONS
--debug
Turn debugging on.
--help
Show the usage message and die.
--version
Show the version number and exit.
AVAILABILITY
The code is licensed under the GNU GPL. Check http://www.argon.org/~roderick/ or CPAN for updated versions.
AUTHOR
Roderick Schertler <roderick@argon.org>
perl v5.16.3 2010-06-11 SHELL-QUOTE(1)