Home » Infrastructure » Unix » How to call a C program in a shell...
How to call a C program in a shell... [message #196129] Wed, 04 October 2006 04:38 Go to next message
oracledba_raja
Messages: 23
Registered: July 2006
Junior Member
Hi All,
Good Morning.

In one of our development server, there is a shell program, which in turn calls a 'c' program.

The c program is compiled and is in executable form.

But it is found that it's not all using the C program
and it skips that program (or unrecognised it?)


here the coding is:

#!/bin/ksh

log_file=/prod/bin/AAA.log
history_file=/prod/history/history.txt
date_stamp=`date "+ %d%m%Y"`

echo "Processing Begin: $date_stamp" >> $log_file
if [ -s "/prod/tmp/AAAA.data" ]
then
echo "Input file found"
if [ ! -s "$history_file" ]
then
echo "STATUS" > $history_file
echo "PROCESSING DATE" >> $history_file
fi

# the follwing "processnew1" is the C program
processnew1
echo "Successfully Completed" >> $log_file
else
echo "Processing: No Input file is there." >> $log_file
fi
echo "Processing End: $date_stamp" >> $log_file
~

The output logfile contains
" Processing Begin: 04102006
Processing: No Input file is there.
Processing End: 04102006 "

===============

File permission

The source program
-rw-r--r-- 1 lms lmsgrp 1826 Oct 4 15:52 processnew1.cc

After compilation with execute permission
-rwxr-xr-x 1 lms lmsgrp 8688 Oct 4 15:56 processnew1

---

Could you please guide me...

Thanks a lot.

Regards,
Raja

Re: How to call a C program in a shell... [message #196523 is a reply to message #196129] Thu, 05 October 2006 14:41 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
Immediately after the program - echo the return code. You need to know what the return codes mean - check with the programmer.

processnew1 
echo "return code is $?"
Re: How to call a C program in a shell... [message #196886 is a reply to message #196523] Mon, 09 October 2006 00:56 Go to previous message
oracledba_raja
Messages: 23
Registered: July 2006
Junior Member
Hi Andrew,
Thanks a lot.

Regards,
Raja.
Previous Topic: file permission in Shell Script
Next Topic: prtconf command
Goto Forum:
  


Current Time: Thu Mar 28 14:10:11 CDT 2024