08-30-2006
Need Clean Exit from KSH Status Loop
I have a ksh loop that monitors front panel key postitions. I need a keystroke or something to break out of the loop without exiting the script.
Code is:
#!/bin/ksh
while true
do
POST=$(./keystat2 | nawk '{print $1}')
if [[ $POST == "NORMAL" ]]; then
print "\nKeyswitch is in the ${POST} position."
elif [[ $POST == "SECURE" ]]; then
print "\nKeyswitch is in the ${POST} position."
elif [[ $POST == "DIAG" ]]; then
print "\nKeyswitch is in the ${POST} position."
fi
done
<Do other script things...>
Exit
Thanks!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i downloaded a text file from metalab.unc.edu called sh.txt and in this reference manual it refers to shell scripting exit status .. at the end of one of the examples that author gave an exit status of 127..
to what does a 127 exit status refer too and what is its purpose in the code.
moxxx68 (1 Reply)
Discussion started by: moxxx68
1 Replies
2. UNIX for Dummies Questions & Answers
Hi all,
i am writing a script to test if some servers are down and prompt if test positive. i used rlogin and rsh then exit but the script when run, logs into the servers and stays.
pls what can i do to salvage this? or what other options do you suggest? (6 Replies)
Discussion started by: sdcoms
6 Replies
3. Shell Programming and Scripting
Hi all,
I'm running a program which return 1 upon success.
But when encounters problem shell return 's '1' .
How to differentiate between them the shell return value and script return value.
Ex. function fn return '1' if executed successfully and '0' if failed. But when if shell encounters... (1 Reply)
Discussion started by: yhacks
1 Replies
4. Shell Programming and Scripting
I'm preparing for exam and one of exams is to write own test command...
I wonder if in unix is a command which just returns exit code you specify..
I know I can easily write a function like this:
exStatus() {
return $1
}
-> my question is rather theoretical
thank you! (9 Replies)
Discussion started by: MartyIX
9 Replies
5. Shell Programming and Scripting
Hi
Can someone help me please?
In a standard UNIX .ksh script, if you have the exit status..say 5...what line do you have to enter into the script for this number to be automatically converted to its actual exit reason by looking up the exit status file...wherever that is?
thanks
angus (1 Reply)
Discussion started by: angusyoung
1 Replies
6. Shell Programming and Scripting
Hi,
Running Oracle Scheduler 11g2 on an AIX 6.01.
I want to run a shell script (called "external program" in Oracle terminology) which executes some commands and react on the outcome using the exit status $?. For example a "cat thisfiledoesnotexist" and then get the $? which should be not zero.... (6 Replies)
Discussion started by: hermanmol
6 Replies
7. Shell Programming and Scripting
how do i get the exit status from a ksh or perl script executed in a java program using Runtime? (1 Reply)
Discussion started by: twk
1 Replies
8. Shell Programming and Scripting
I have a shell script (#!/bin/sh) that interacts with Appworx and Banner Admin. In my script I want to check the exit status of awrun before continuing. awrun can run for 10 seconds or it can run for over a minute. So my question is, will it go through my if statement before awrun may even be... (2 Replies)
Discussion started by: smkremer
2 Replies
9. Shell Programming and Scripting
Hi
Im trying to write a script that will archive some file using java program.Below is the part of the script that I use and my problem is that the script always return with status 0.Below is part of my script(end part)
purge.ksh
echo "No of files before tar :... (4 Replies)
Discussion started by: saachinsiva
4 Replies
10. Shell Programming and Scripting
Hi All,
I am trying to create a zip file with all the txt files(these are in large number) in the current directory. I am able to do this operation sucessfully.
After this i want to get the status of the tar command executed and do accordingly. When i am trying with the below code, the status... (3 Replies)
Discussion started by: paddu
3 Replies
LEARN ABOUT MOJAVE
curlopt_post
CURLOPT_POST(3) curl_easy_setopt options CURLOPT_POST(3)
NAME
CURLOPT_POST - request a HTTP POST
SYNOPSIS
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POST, long post);
DESCRIPTION
A parameter set to 1 tells libcurl to do a regular HTTP post. This will also make the library use a "Content-Type: application/x-www-form-
urlencoded" header. (This is by far the most commonly used POST method).
Use one of CURLOPT_POSTFIELDS(3) or CURLOPT_COPYPOSTFIELDS(3) options to specify what data to post and CURLOPT_POSTFIELDSIZE(3) or CUR-
LOPT_POSTFIELDSIZE_LARGE(3) to set the data size.
Optionally, you can provide data to POST using the CURLOPT_READFUNCTION(3) and CURLOPT_READDATA(3) options but then you must make sure to
not set CURLOPT_POSTFIELDS(3) to anything but NULL. When providing data with a callback, you must transmit it using chunked transfer-encod-
ing or you must set the size of the data with the CURLOPT_POSTFIELDSIZE(3) or CURLOPT_POSTFIELDSIZE_LARGE(3) options. To enable chunked
encoding, you simply pass in the appropriate Transfer-Encoding header, see the post-callback.c example.
You can override the default POST Content-Type: header by setting your own with CURLOPT_HTTPHEADER(3).
Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. You can disable this header with CURLOPT_HTTPHEADER(3) as
usual.
If you use POST to a HTTP 1.1 server, you can send data without knowing the size before starting the POST if you use chunked encoding. You
enable this by adding a header like "Transfer-Encoding: chunked" with CURLOPT_HTTPHEADER(3). With HTTP 1.0 or without chunked transfer, you
must specify the size in the request.
When setting CURLOPT_POST(3) to 1, it will automatically set CURLOPT_NOBODY(3) to 0.
If you issue a POST request and then want to make a HEAD or GET using the same re-used handle, you must explicitly set the new request type
using CURLOPT_NOBODY(3) or CURLOPT_HTTPGET(3) or similar.
DEFAULT
0, disabled
PROTOCOLS
HTTP
EXAMPLE
TODO
AVAILABILITY
Along with HTTP
RETURN VALUE
Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.
SEE ALSO
CURLOPT_POSTFIELDS(3), CURLOPT_HTTPPOST(3),
libcurl 7.54.0 February 03, 2016 CURLOPT_POST(3)