Visit Our UNIX and Linux User Community


Problem in checking file abort


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem in checking file abort
# 1  
Old 04-10-2008
Problem in checking file abort

Hi,

I would like to know given executing a file with inputs, I would like to know when does it terminate /abort abnormally.

I tried to append an echo $? after executing my program which is in C. However, there is nothing..It shows 0 even though the program actually exit.

my command is something like
Code:
a.exe 4 4 4 < 3 3 3 | echo $?

Please advise. Thanks.

Last edited by Yogesh Sawant; 04-10-2008 at 05:55 AM.. Reason: added code tags
# 2  
Old 04-16-2008
Quote:
Originally Posted by ahjiefreak
Hi,

I would like to know given executing a file with inputs, I would like to know when does it terminate /abort abnormally.

I tried to append an echo $? after executing my program which is in C. However, there is nothing..It shows 0 even though the program actually exit.

my command is something like
Code:
a.exe 4 4 4 < 3 3 3 | echo $?

Please advise. Thanks.
Your example runs the echo command and a.exe at the same time and redirects the output from one to another, you want to run a.exe then (once it finishes running) ask the shell for the exit code.
Try:
Code:
a.exe 4 4 4 < 3 3 3 ; echo $?


Previous Thread | Next Thread
Test Your Knowledge in Computers #647
Difficulty: Medium
Window Maker is a free and open-source window manager for the X Window System designed to emulate NeXTSTEP's GUI.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with ssh and checking if file exists

Hi All, I am facing a problem while checking for existence of file over ssh ! Basically, i want to ssh and check if file exists.. If file exists return 1. If file does not exits return 0 (or any value) I am using the below code file_avail=`ssh username@host "if ]; then exit 1;... (10 Replies)
Discussion started by: galaxy_rocky
10 Replies

2. Shell Programming and Scripting

Shell Script to Abort if file name has space.

Hi, In my shell script I use the following code to copy files from one directory to other. for file in `ls`; do #----------------- Copy Files From INDIR to OUTDIR -------------# echoen "Copying File ${INDIR}/$file to ${OUTDIR}/${file}" cp ${INDIR}/$file ... (4 Replies)
Discussion started by: pinnacle
4 Replies

3. Solaris

I can't copy any file to any machine | abort problem | freezing

I want to copy tar file to another machine. tar size is 4gb. Firstly I tried copy to windows machine with ftp client but copy operation didn't start. Now I have tryied to copy to solaris machine command with scp but copy was freezed. Picture is attached.... (1 Reply)
Discussion started by: getrue
1 Replies

4. UNIX for Advanced & Expert Users

How to abort file transfer if the file is already existing?

Hi , while doing FTP from mainframe to unix if the file we are sending is already existing in the server ,it is getting replaced.when i used sunique command,its not replacing but stil creates a copy of the file with .1 to .99 extension.is there any way to abort the file transfer if the file is... (3 Replies)
Discussion started by: amodmenon
3 Replies

5. Programming

C++ - Problem in asking and checking user's passwd

This is the source code: #include <pwd.h> #include <iostream> #include <string.h> using namespace std; int main() { struct passwd *user; char login="alex", password="qwertyuiop"; if ((user= getpwnam(login)) == NULL) cout << "No such user\n"; else if... (24 Replies)
Discussion started by: hakermania
24 Replies

6. UNIX for Dummies Questions & Answers

Basic number checking problem

Hello all I am having problems using a bash script to read the input from the user and checking that its a valid number. I only want the user to input a maximum of a 3 number string (321 , 521 , 871 etc.). Anything longer or that includes a chararcter or symbol will display an error message. ... (8 Replies)
Discussion started by: ChrisHoogie
8 Replies

7. Shell Programming and Scripting

Facing problem in checking the directory existence

Hi All, I have a written a scell script which checks the existence of a directory. The dierctory name is read from property file. Though the dierctory exists but it says - it does not exist-- Find my code below -- #! /bin/ksh #Tibco Properties file is inclusion .... (5 Replies)
Discussion started by: supriyabv
5 Replies

8. UNIX for Dummies Questions & Answers

Problem in checking space of mount.Please help me

Hi everyone, I am writing a script. As a part of this script, I wanted to check the space of few mounts, If the space usage percentage of the mount crosses over a certain limit then i wanted to display a warning message. The following is the command df -k | awk ' { if (($6 == "/export/temp")... (4 Replies)
Discussion started by: Sheethal
4 Replies

9. UNIX for Advanced & Expert Users

examine core file after abort()

I'm running Red Hat Linux 2.6.7 on a x86_64 box. I have a core file from a program that called abort(). Does anyone here know how can I get a backtrace? (Re-creating the error with svd running inside gdb has proved impossible). % gdb svd core.25223 GNU gdb Red Hat Linux... (2 Replies)
Discussion started by: svact
2 Replies

10. Shell Programming and Scripting

Error Checking Problem

Here is my problem I'm designing a script that will have to accept user input from the command line using the read command. The problem is that I have to check the input which should be in the format of <first name> <last name> <phone number (8 digits long)> The input can also be ... (4 Replies)
Discussion started by: pokeycam
4 Replies

Featured Tech Videos