Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Check if file is empty with variables, bash Post 302855475 by bjoern456 on Friday 20th of September 2013 05:50:04 AM
Old 09-20-2013
I am using the terminal in openSuse 12.3 and ls -v lists the files in a numerical way like this: (1,2,3,..,10,11,..,100).

Thank you guys, now it works! I lost the "fi" and $i was allready the name of the file as you said.Smilie
 

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. Shell Programming and Scripting

How to check if two variable are empty strings at once? (bash)

I need to check if $1 or $2 are empty before continuing but I don't know if bash has any logic of the sort. This is what I'm looking for - except that "and" doesn't seem to work. if and ;then ... Thank you! :D (4 Replies)
Discussion started by: ph0enix
4 Replies

4. 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

5. 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

6. Shell Programming and Scripting

Bash-Shell: If-Clause to check if file is empty

Hello, I want to checkl whether my file has text in it or not. if ; then ... if ; then ... But none of these work Can someone help me? ---------- Post updated at 09:00 AM ---------- Previous update was at 08:55 AM ---------- The code-tags caused an displayerror,... (5 Replies)
Discussion started by: ABE2202
5 Replies

7. 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

8. 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

9. Shell Programming and Scripting

Empty file check

Hi gurus , I have two files and i want to perform different action based on the condition if both or either is empty If then Do something elif then do something elif then do something else do something fi I have tried the below bt its not... (4 Replies)
Discussion started by: r_t_1601
4 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
ul(1)							      General Commands Manual							     ul(1)

Name
       ul - process underscores for terminal

Syntax
       ul [-i] [-t terminal] [name...]

Description
       The  command  reads  the  named files (or standard input if none are given) and translates occurrences of underscores to the sequence which
       indicates underlining for the terminal in use, as specified by the environment variable TERM.  The -t option overrides  the  terminal  kind
       specified  in  the  environment.  The file /etc/termcap is read to determine the appropriate sequences for underlining.	If the terminal is
       incapable of underlining, but is capable of a standout mode then that is used instead.  If the terminal can overstrike, or  handles  under-
       lining automatically, degenerates to If the terminal cannot underline, underlining is ignored.

       The  -i option causes to indicate underlining by a separate line containing appropriate dashes `-'; this is useful when you want to look at
       the underlining which is present in an output stream on a crt-terminal.

Options
       -i Displays underscoring on separate line containing appropriate dashes (-).

       -t terminal
	  Uses type of specified terminal in place your terminal's type.

Restrictions
       The command usually outputs a series of backspaces and underlines intermixed with the text to indicate underlining.  No attempt is made	to
       optimize the backward motion.

See Also
       man(1), nroff(1), colcrt(1)

																	     ul(1)
All times are GMT -4. The time now is 04:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy