07-21-2006
Status code of last command execution
Hello people,
I am using KSH and inside my script I do a cksum and check the status code to see whether the command sucessfully. Here even though the cksum fails due to file not existing the status returned is still 0 because the awk command worked fine. How do I capture just the status of the cksum command execution without breaking the below listed code into multiple lines. Please let me know.
/usr/bin/cksum $cksum_tmpdir/$EXTFILE | awk '{print $1 $2}' > $cksumb
echo $?
Regards,
Tipsy.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi folks,
I wrote a ksh program which run scripts from remote server.
To check the status code I wrote the following function:
check_remote_status()
{
status_code=`tail -1 $installLog`
if ] ; then
echo $errMsg | tee -a $installLog
exit 1
else
echo $validMsg >> $installLog
fi... (9 Replies)
Discussion started by: nir_s
9 Replies
2. Shell Programming and Scripting
How to capture output or numeric part given by $? command into the variable?
If I go for
var=`$?`
then $var is found empty. (2 Replies)
Discussion started by: videsh77
2 Replies
3. Shell Programming and Scripting
Hi,
I am using Win32::IEAutomation module to automate my Web based application.
I am trying to prepare a report for the test cases I automated.
The problem is I am unable to get the execution status of the commands gotoURL, getButton .... to know if my button click or url redirection is... (2 Replies)
Discussion started by: gurukottur
2 Replies
4. Shell Programming and Scripting
Hello, I need advice on how to check if started processes are finished in perl, here's explanation :
OS is RHEL 4, perl -v = "This is perl, v5.8.0 built for i386-linux-thread-multi"
The logic of the script :
#!/usr/bin/perl
use warnings;
$param1 = $ARGV;
$param2 = $ARGV;
$param3 =... (2 Replies)
Discussion started by: sysgate
2 Replies
5. Shell Programming and Scripting
a) cd /root/user/dir/sd/disk
./runInstaller -silent -responseFile
b) cd /root1/user1
cp /root/user/dir/sd/disk/ram.txt
now a) executes and starts running but b) interupts a) and is executed while a) is running on the other hand
so I want b) to start only after successfull completion of... (6 Replies)
Discussion started by: sriki32
6 Replies
6. UNIX for Dummies Questions & Answers
Hello,
Sorry for my english.
I have an arcade site.
mydomain.com/game.html If database has the game name is good.
mydomain.com/fd43f54.html if database has not the game name redirect to mydomain.com by 302 error code.
if database has not the game name i want a 301/404 error code and no... (0 Replies)
Discussion started by: hoo
0 Replies
7. Shell Programming and Scripting
Hi Experts,
I am very much new to linux scripting, I am currently working on reducing my manual work and hence writing a script to automate few task.
I am running below command to snmpwalk the router..
snmpwalk -v 3 -u WANDL_SU -a MD5 -A vfipmpls -x DES -X VfIpMpLs -l authPriv... (19 Replies)
Discussion started by: Hanumant.madane
19 Replies
8. Shell Programming and Scripting
below is the output xml string from some other command and i will be parsing it using awk
cat /tmp/alerts.xml
<Alert id="10102" name="APP-DS-ds_ha-140018-componentFailure-S" alertDefinitionId="13982" resourceId="11427" ctime="1359453507621" fixed="false" reason="If Event/Log Level(ANY) and... (2 Replies)
Discussion started by: vivek d r
2 Replies
9. Shell Programming and Scripting
Greetings Experts,
I am on AIX using ksh. Created a unix script which generates the CREATE OR REPLACE VIEW ... and GRANT .. statements, which are placed in a single .txt file. Now I need to execute the contents in the file (there are around 300 view creation and grant statements) in Oracle and... (4 Replies)
Discussion started by: chill3chee
4 Replies
10. UNIX for Beginners Questions & Answers
Hi,
I am working on a file copier utility where I have written the copy commands to a batch file e.g. file_copier.bat which i pass to xargs command as follows.
cat file_copier.bat | xargs -n 1 -P 40
I also want to record the copy command status of each file/command in the form "command... (1 Reply)
Discussion started by: ankur singh
1 Replies