Sponsored Content
Full Discussion: Empty file check
Top Forums Shell Programming and Scripting Empty file check Post 302890386 by Scrutinizer on Wednesday 26th of February 2014 01:24:29 PM
Old 02-26-2014
Yes the part after the && will only get evaluated if the part before the && is true. This is by design, && is not a true logical AND.


--
Also there is a syntax error, since the "then" statements were omitted.

--
Also there are the wrong quotes characters in you file! Replace them with "

Last edited by Scrutinizer; 02-26-2014 at 03:24 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to check for empty file in Perl?

Hi, May I know how to check for empty file in Perl. Iam missing something, somewhere. #!/usr/bin/perl my $open_dir = '/path/'; my $file; my $ma = "abc_.*.\.psv\$" opendir(VAR, $open_dir) or die "Can't open $oepn_dir: $!\n"; while( defined ($file = readdir VAR) ) #read all... (1 Reply)
Discussion started by: deepakwins
1 Replies

2. UNIX for Dummies Questions & Answers

How to check if a file is empty?

Hi Masters..... I have problem !!! I need to check number of records in a file and if it is zero or file is empty i need to do some task. if ; then echo "File s empty" else echo "Not empty" fi so how to check this condition. I used wc -l < filename.txt => 1 for zero records same result... (1 Reply)
Discussion started by: shreekrishnagd
1 Replies

3. UNIX for Dummies Questions & Answers

to check if file is empty or not and return a non zero value

Hi All, I am new to unix worldd . I need to check a file1 if its empty or not. If its empty then return a non zero value say 99 could you pls let me know the perl script for this. (2 Replies)
Discussion started by: mavesum
2 Replies

4. Shell Programming and Scripting

check if file is empty

How do I check if a file is empty in a sh script I want to test in my shell script if the output file is empty and if it is do one thing and if it isnt empty do another? any ideas? (8 Replies)
Discussion started by: stolz
8 Replies

5. Shell Programming and Scripting

Need to check for empty file in C shell script

I am running a C shell script. I have an output file from a previous step and I need to run "something" in the next step to check if the file is empty. If the file is empty, then the job script should finish EOJ. If the file is not empty then the job script should abend. Please help Thanks. (4 Replies)
Discussion started by: jclanc8
4 Replies

6. Shell Programming and Scripting

Check if a text file is empty or not (using ls -s)

Hello, I want to make a script which says if a text file is empty or not. I tried two ways of making it, but I have problems with both of them. Now I think that the better way is the ls -s solution (considering that an empty text file has a 0 weight, because "cat file.txt" fails when file is... (4 Replies)
Discussion started by: Link_
4 Replies

7. Shell Programming and Scripting

Condition to check whether configuration file is empty or not?

CMD=$(find "${Release_Container}" -iname "${Release_Name}"_Release.txt) for i in `cat $CMD` do if ];then cd ${Sandbox_dir} CMD1=$(find "${Sandbox_dir}"/* -iname "${Release_Name}" -type d | awk -F/ '{print $(NF)}' | head -1 ) if ];then echo -e "################### CHECKOUT START... (2 Replies)
Discussion started by: anuragpgtgerman
2 Replies

8. UNIX for Dummies Questions & Answers

Check if file is empty with variables, bash

Hello again! I have some trouble with scripting in bash. In the following script I read from a folder with the files line0_Ux.xy line1_Ux.xy line2_Ux.xy . . . Some of the files are empty. For those I would like to print a "0" in list. I think the problem with the code is that... (4 Replies)
Discussion started by: bjoern456
4 Replies

9. Shell Programming and Scripting

How to check if the file is empty or has blank space.?

Hi, I am using KSH. I am trying to check if the output file is empty or not. I tried with ] but what i see is my file is empty but still manages to have a size of 1 instead of 0. But my file doesnot have anything its empty. I am not sure how to check this. can any one help? (10 Replies)
Discussion started by: Sharma331
10 Replies

10. Shell Programming and Scripting

To check whether the file is empty or not in shell script (sh)

Hi All, I need to check a file whether it exists and also whether it is empty or not. I have a code for this but it is not working as per my requirement. Can anyone pls suggest me on this. function funcFLSanityCheck { if then echo "${varFLSentFileListPath}/${varFLSentFileName}... (7 Replies)
Discussion started by: Arun1992
7 Replies
File::Spec::Link(3pm)					User Contributed Perl Documentation				     File::Spec::Link(3pm)

NAME
File::Spec::Link - Perl extension for reading and resolving symbolic links SYNOPSIS
use File::Spec::Link; my $file = File::Spec::Link->linked($link); my $file = File::Spec::Link->resolve($link); my $dirname = File::Spec::Link->chopfile($file); my $newname = File::Spec::Link->relative_to_file($path, $link); my $realname = File::Spec::Link->full_resolve($file); my $realname = File::Spec::Link->resolve_path($file); my $realname = File::Spec::Link->resolve_all($file); DESCRIPTION
"File::Spec::Link" is an extension to "File::Spec", adding methods for resolving symbolic links; it was created to implement "File::Copy::Link". "linked($link)" Returns the filename linked to by $link: by "readlink"ing $link, and resolving that path relative to the directory of $link. "resolve($link)" Returns the non-link ultimately linked to by $link, by repeatedly calling "linked". Returns "undef" if the link can not be resolved. "chopfile($file)" Returns the directory of $file, by splitting the path of $file and returning (the volumne and) directory parts. "relative_to_file($path, $file)" Returns the path of $path relative to the directory of file $file. If $path is absolute, just returns $path. "resolve_all($file)" Returns the filename of $file with all links in the path resolved, wihout using "Cwd". "full_resolve($file)" Returns the filename of $file with all links in the path resolved. This sub tries to use "Cwd::abs_path" via "->resolve_path". "resolve_path($file)" Returns the filename of $file with all links in the path resolved. This sub uses "Cwd::abs_path" and is independent of the rest of "File::Spec::Link". Object methods "new([$path])" create new path object: stores path as a list "path" returns path as a string, using catpath "canonical" returns canonical path, using canonpath "vol" returns volume element of path, see File::Spec->splitpath "dir" returns directory element of path, as a string, see File::Spec->splitpath "dirs" return list of directory components in path, see File::Spec->splitdir "pop" remove last component of the path "push($file)" add a file component to the path, ignoring empty strings "add($file)" add a component to the path: treating "updir" as "pop", and ignoring "curdir" and empty strings "split($path)" populate a path object, using splitpath "chop" remove and return a file component from path, an empty string returns means this was root dir. "relative($path)" replace the path object with the supplied path, where the new path is relative to the path object "follow" follow the link, where the path object is a link "resolved" resolve the path object, by repeatedly following links "resolvedir" resolve the links at all component levels within the path object Other class methods "canonpath($path)" Wrapper round File::Spec::canonpath, fatal if empty input "catdir(@dirs)" Wrapper round File::Spec::catdir, returns "curdir" from empty list "splitlast($path)" Get component from $path (using "chop") and returns remaining path and compenent, as strings. [Not used] EXPORT None - all subs are methods for "File::Spec::Link". SEE ALSO
File::Spec(3) File::Copy::Link(3) AUTHOR
Robin Barker, <Robin.Barker@npl.co.uk> COPYRIGHT AND LICENSE
Copyright 2003, 2005, 2006, 2007 by Robin Barker This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.4 2011-09-30 File::Spec::Link(3pm)
All times are GMT -4. The time now is 09:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy