12-23-2007
Quote:
Originally Posted by
WebKruncher
Can you do this on every OS?
Most operating systems have an equivalent.
In Windows GUI land it's GetMessage(), in Winsock[2] it's select(), also WaitForMultipleObjects().
Palm programs have a message loop at the heart of any program.
What ever you are doing, do it efficiently, even if you are doing nothing, do nothing as efficiently as possible.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I wrote a smiple ksh function
send_notification() {
...
}
and want to execute it on each file, matched by the find command.
I tried:
find / -name "*.err" -mtime -8 -exec send_notification {} \;
but it doesn't work. What should I do? I work in ksh on Hp-Ux.
Regards,
Pit (11 Replies)
Discussion started by: piooooter
11 Replies
2. Shell Programming and Scripting
Hi All,
Can you please tell me how to execute local function written in a shell script with awk.
i tried with system command but its giving an error. (1 Reply)
Discussion started by: krishna_gnv
1 Replies
3. UNIX for Advanced & Expert Users
I have a script A which calls script B. I wrote a function in script A to be executed when Kill command is issued for script A and I invoke that function using the trap command.The function identifies all child process running under script A (in this case script B) and kills the child process and... (3 Replies)
Discussion started by: smohandass
3 Replies
4. Shell Programming and Scripting
Gurus,
Can you please tell me why this script is executing but i am getting no result...also can you tell me what is this gettime() doing?
in a script i wrote this hour.SH
--------------------------
gettime() {
date '+%H' | {
read hour
TIME=${hour}
}
}
:
----------------------... (2 Replies)
Discussion started by: RubinPat
2 Replies
5. UNIX for Dummies Questions & Answers
dear all
i need your advice in shell with solaris
i have testing script like this
#!/usr/bin/bash
function test(){
echo "testing only"
}
## execute function ##
test
but if i running always got error like this
test.sh: syntax error at line 1: `(' unexpected
who can i running this... (7 Replies)
Discussion started by: zvtral
7 Replies
6. Shell Programming and Scripting
Here is some back ground on the script. The script is to poll an arbitrary number of DB's. To do this I am creating a function that takes the file_path to the DB and the min poll interval as arguments. The function will be called for each DB and then ran in the background. The function I was... (6 Replies)
Discussion started by: ryandavison
6 Replies
7. Shell Programming and Scripting
Hi
I am trying to a write a script which gives message queue depth for every 5 mins in a file.
Commands that I use are
runmqsc QM_Name
display ql(*) curdepth
Since I can use only MQSC commands I need help on how to fetch the output on to a file after executing display command. (3 Replies)
Discussion started by: jhilmil
3 Replies
8. Shell Programming and Scripting
#!/bin/bash
function getDeliveredDispatches(firstDateTime, lastDateTime, limit) {
var cursor = db.dispatches.find(
{$and: }}
]},
{"deliveryGroupId" : 1, "batchId": 1, "statusHistory.code" : 1}
);
var wrongDispatchesIds = ;
print("Number of dispatches selected based on filter = " +... (2 Replies)
Discussion started by: neel2462
2 Replies
9. Shell Programming and Scripting
Hi,
I am new to shell scripting and i need to write a automation script to execute sql files. I need to check the table if it is there in system tables and need to write a function to call the .sql files.
For ex. I have a.sql,b.sql,c.sql files, where the sql file contains DELETE and INSERT... (1 Reply)
Discussion started by: Samah
1 Replies
10. Shell Programming and Scripting
Hi All,
I have a menu driven scripts. As you know while running the script we have to input the option such as 1,2, and 3 to execute function accordingly. but after selecting the input we have to press Enter.
My requirement is to execute function as soon as we press the option.
Is there... (5 Replies)
Discussion started by: kiran_j
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)