Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Getting same exit status for empty and non empty file Post 302264136 by methyl on Wednesday 3rd of December 2008 08:04:49 AM
Old 12-03-2008
The $? value in your script is coming from the preceding successful "echo" statement.
If you want to see the reply from "test", try:
test -s $DD_INDD ; ERROR=$?
Then check the reply value in $ERROR.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Deleting the empty file

Hi, I have a TEST.dat file. As a clean up process, I have to delete the TEST.dat file if it is empty. Basically, I don't want to delete TEST.dat if it contains anything in it but want to delete TEST.dat if it contains any spaces or nothing in it. Is there a command to check if the file... (2 Replies)
Discussion started by: rkumar28
2 Replies

2. UNIX for Advanced & Expert Users

empty file in hp-ux

Hi, I need your help. How can I create an empty filename with a specific size, in hp-ux? Regards, Mizi (2 Replies)
Discussion started by: Mizi
2 Replies

3. Shell Programming and Scripting

File is not empty?

How do I check to make sure a file is not zero bytes? Something like: if then ????? (7 Replies)
Discussion started by: lesstjm
7 Replies

4. UNIX for Dummies Questions & Answers

how to find empty folders without using -empty

hi all: my solaris FIND does not support find myFolder -type d -empty how can i find the empty folders? thanks! (7 Replies)
Discussion started by: lasse
7 Replies

5. Shell Programming and Scripting

how to see if the file is empty or not?

hi how can I determine, if a file is empty or not?I am using read line clause. The script should be like: while read line do if(file is empty) then; ...... done < $blacklist (1 Reply)
Discussion started by: tjay83
1 Replies

6. Shell Programming and Scripting

while file is empty

how can i use while loop ? while file is empty do.... if not empty do ..... in bash (1 Reply)
Discussion started by: Trump
1 Replies

7. Shell Programming and Scripting

Grep for empty file

I have a program that takes a file in which I use a sed to remove some data that is not needed. If all of the data is removed. I want to grep for that in the file and print that there is no data left in the file. When I use sed, I replace a word with nothing but it still seems to leave a return... (5 Replies)
Discussion started by: plawr
5 Replies

8. Shell Programming and Scripting

Empty out the file

Hi All, I have a piece of perl code in which I DON'T want to delete a file rather empty out the contents, here is the code - if ( unlink("$opt_b") == 1 ) { print_log( "$opt_b deleted", 1 ); }else { print_log( "Could not delete $opt_b:$!", 1 ); ... (5 Replies)
Discussion started by: jacki
5 Replies

9. Shell Programming and Scripting

if/else with an empty file...

Hi there, I'm just starting out with shell scripting and I'm trying to make a test where the script will basically run yum check-update to find out if the server has any available and if it does it e-mails me but if not it will just stop there. I have it working if there are actually... (7 Replies)
Discussion started by: Imnewtothis
7 Replies

10. UNIX for Dummies Questions & Answers

find command on a empty directory - bad status

when I run the following command in AIX (bash), find ./* I get the following error. find: bad status-- ./* Thats becasuse, its an empty directory. The same works, when there the directory is not empty. Even though the find deesnt have to rerun any result. My full find command would look... (4 Replies)
Discussion started by: deepakwins
4 Replies
mq_receive(2)							System Calls Manual						     mq_receive(2)

NAME
mq_receive - receive a message from a message queue SYNOPSIS
DESCRIPTION
The system call receives the oldest of the highest priority message from the message queue specified by mqdes. The selected message is removed from the queue and copied to the buffer pointed to by the msg_ptr argument. The argument, msg_len, specifies the size of the buffer in bytes. The value of msg_len should be greater than or equal to the mq_msgsize attribute of the message queue, or will fail. If the argument msg_prio is not NULL, the priority of the message removed from the queue is stored in the location pointed to by msg_prio. If the specified message queue is empty and the flag is not set in the message queue blocking status associated with mqdes, will block in priority order, until it can receive a message from the queue, or until is interrupted by a signal. If the specified message queue is empty and the flag is set in the message queue blocking status associated with mqdes, will not wait for a message to arrive on the queue and will return with an error. To use this function, link in the realtime library by specifying on the compiler or linker command line. RETURN VALUE
returns the following values: n Successful completion. n is the size of the selected message in bytes and the message is removed from the queue. Failure. is set to indicate the error and no message is removed from the queue. ERRORS
If fails, is set to one of the following values: [EAGAIN] The flag is set in the message queue blocking status associated with mqdes, and the message queue is empty. [EBADF] mqdes is not a valid message queue descriptor open for reading. [EINTR] A signal interrupted the call to [EINVAL] msg_ptr points to an invalid address. [EMSGSIZE] The specified message buffer size, msg_len, is less than the message size attribute of the message queue. [ENOSYS] is not supported by the implementation. SEE ALSO
mq_send(2). STANDARDS CONFORMANCE
mq_receive(2)
All times are GMT -4. The time now is 08:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy