If (! -z $file || $status != 0 ) ... what its mean


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers If (! -z $file || $status != 0 ) ... what its mean
# 1  
Old 12-03-2013
If (! -z $file || $status != 0 ) ... what its mean

hi can anybody help ..

Code:
if (! -z  $file || $status != 0 )

... what its mean

Moderator's Comments:
Mod Comment Use code tags, see PM.

Last edited by zaxxon; 12-03-2013 at 09:05 AM..
# 2  
Old 12-03-2013
That depends on the environment that you are working in. Let's assume it's a bash shell, it comes close to a test of a file size being not zero and a status not being 0. But were it bash, the right syntax would be either
Code:
if [ ! -z "$file" ] || [ "$status" != 0 ]

or
Code:
if [ ! -z "$file" -o "$status" != 0 ]

# 3  
Old 12-03-2013
Assuming that is the csh shell, it means

if
[ the variable $file is not empty ]
or
[ the variable $status is not equal to zero ]



It helps to give context to your questions - assuming you want a decent answer.
So, it this csh shell code?
This User Gave Thanks to jim mcnamara For This Post:
# 4  
Old 12-03-2013
This User Gave Thanks to CarloM For This Post:
# 5  
Old 12-03-2013
As you can tell we are all guessing....
# 6  
Old 12-03-2013
You are double posting questions, which can be quite annoying as you will get a variety of different answers in different threads, but the discussion will wander about depending who answers what where and we will spend double time trying to help you - and we're all doing this for free.


As on the other thread directed to by CarloM I would suggest:-

Quote:
Have a read of the manual pages for test
Code:
man test

There are all sorts of options you can use in deciding which chunk of code to process next.


I hope that this helps more than me just giving you a one-line answer.



Robin
Liverpool/Blackburn
UK
# 7  
Old 12-04-2013
yes it is cshell code .. Thanks for u r post

---------- Post updated at 11:48 PM ---------- Previous update was at 11:43 PM ----------

yes, it is Cshell script code only
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

How to track table status delete/update/insert status in DB2 V10 z/os?

Dear Team I am using DB2 v10 z/os database . Need expert guidance to figure out best way to track table activities ( Ex Delete, Insert,Update ) Scenario We have a table which is critical and many developer/testing team access on daily basis . We had instance where some deleted... (1 Reply)
Discussion started by: Perlbaby
1 Replies

2. UNIX for Dummies Questions & Answers

Know File Status

Hi Guys, how to know the status of a file to whether it is copied partially from the source location or completly copied. Appreciate your quick reply on this. ---------- Post updated at 05:16 AM ---------- Previous update was at 04:34 AM ---------- #!/bin/ksh file_nm=$1 no_of_tries=5... (2 Replies)
Discussion started by: palanisvr
2 Replies

3. UNIX for Advanced & Expert Users

File Status 92 reading a sequential file

Hi. I have a process that execute a Microfocus Cobol. This process read a large sequential file and update or insert in a table Oracle. This process run smoothly in some ocasions but in a file whor have more than 400,000 registers, the cobol program doesn't finish read all the records,... (3 Replies)
Discussion started by: hornam
3 Replies

4. UNIX for Dummies Questions & Answers

checking the status of file ftp

Hi, I m new to unix and I need a help in FTp-ing a file. My script is given below ftp -n <<END_SCRIPT open $FTP_HOST user $FTP_USER $FTP_PASSWD lcd $TEMPFOLDER cd $FTP_LOCATION put $1 bye END_SCRIPT exit_status=$? if ; then log "successfully FTPed the file" else... (5 Replies)
Discussion started by: MeeraNair
5 Replies

5. UNIX for Dummies Questions & Answers

COBOL file status 39

When I execute a COBOL load module, I get the following error: $ a.out IWZ200S Error detected during OPEN for file 'ABE-INPUT'. File status is: 39. Message routine called from offset 0x38 of routine iwzWriteERRmsg. iwzWriteERRmsg called from offset 0x3c4 of routine... (3 Replies)
Discussion started by: jbrubaker
3 Replies

6. Red Hat

Installing RedHat 8.0 onto Dell PowerEdge SC1425 - hdc: status error: status = 0x58

I have successfully installed RedHat 8.0 onto a Dell PowerEdge SC1425 today. This server has two SATA hard drives, and an IDE DVD-ROM drive. Using the following kernel parameters, i successfully installed across both hard drives from CD: ide0=0x1f0,0x3f6,14 vga=791 resolution=1024x768 expert... (5 Replies)
Discussion started by: fishsponge
5 Replies

7. Shell Programming and Scripting

check the status and send an email with status

Hi, We have a text file which has the following data. ISA~00~ ~00~ ~ZZ~VISTN ~ZZ~U1CAD ~051227~183 7~U~00200~000011258~0~P~< GS~FA~EE05J~U1CAD~051227~1831~000011258~X~002002 ST~997~0001 AK1~SH~247 AK2~856~2470001 AK5~A AK2~856~2470002 AK5~A... (3 Replies)
Discussion started by: isingh786
3 Replies

8. Shell Programming and Scripting

File arrival status

If there is a file being transferred from one box to another box, How can one confirm on the 2nd box..that the file has arrived, and transfer is complete ? I mean in addition to checking the file exists, I want to confirm its transferred completely and not growing in size. (4 Replies)
Discussion started by: amsh76
4 Replies

9. UNIX for Dummies Questions & Answers

Couldn't open status file /var/samba/STATUS.LCK

I believe i have most of samba configured right but i get this error each time time try to run it. I was given suggestion that i touch the file, i did, but i still cannot rid myself of this error. Any suggestions (2 Replies)
Discussion started by: macdonto
2 Replies

10. UNIX for Dummies Questions & Answers

file status during FTP

Help!!!! Can Anyone out there help me? I need to write a script to automate a task to translate files. The files will be transfered through ftp to the workstation. Is there a way to check the file status whether the file has finished being transfered or still transfering. Or is there a way to... (3 Replies)
Discussion started by: sean76
3 Replies
Login or Register to Ask a Question