Sponsored Content
Full Discussion: conditional statement
Top Forums UNIX for Advanced & Expert Users conditional statement Post 302560578 by animesharma on Friday 30th of September 2011 08:25:26 AM
Old 09-30-2011
conditional statement

I need to implement something like this.

1) search for a file(say *.doc) from a path (say /home/user/temp)
2) if file found & if file size > 0 : yes --> file valid
else : print file not valid.

I am trying to implement something like this, but seems i am terribly wrong somewhere..
PLZ help.

Code:
#!/bin/csh -f

if (-e /home/user/temp/*.doc) then
    echo file found
    size = `ls /home/user/temp/*.doc -l | awk '{print $5}'`
    if (size > 10) then
       echo file valid
    else
       echo file invalid
    endif
endif

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk conditional statement

how can i use awk or sed to do a conditional statement, so that HH:MM if MM not great than 30 , then MM=00 else MM=30 ie: 10:34 will display 10:30 10:29 will display 10:00 a=$(echo 10:34 | awk ......) Thanks in advance (10 Replies)
Discussion started by: 3Gmobile
10 Replies

2. Shell Programming and Scripting

quoting in conditional statement

can somebody help, what quote i should use in below statement or what wrong of it ? the 1st (*) is a char, the 2nd and 3rd (*) is a wildcard if ] && ] && ] ................^ .............^ then echo "ok" fi thanks in advance. (2 Replies)
Discussion started by: 3Gmobile
2 Replies

3. Shell Programming and Scripting

conditional statement

Hi Does Unix have a conditional statement like Java as follows: Condition ? Statement1 : Statement2 Thanks (8 Replies)
Discussion started by: lalelle
8 Replies

4. Shell Programming and Scripting

conditional statement

Hi all, The following code is to find if a list of numbers from one file are within the range in another file. awk -F, '\ BEGIN { while ((getline < "file2") > 0) file2=$3 } {for (col1 in file2) if ($0>=30 && $1<=45) print $0} ' FILE1 But where I have the number 30 and 45, I... (3 Replies)
Discussion started by: dr_sabz
3 Replies

5. UNIX for Dummies Questions & Answers

Problem with conditional statement

Hi, I'm getting a "bad number" error from the following conditional if statement. I understand the results of the grep command are not being treated a an integer but am unsure of the correct syntax. Any help would be appreciated. if Thanks (2 Replies)
Discussion started by: dlafa
2 Replies

6. Shell Programming and Scripting

if conditional statement

Hi, I have a script like this: sample.sh mapping=$1 if then echo "program passed" fi I'm running the above script as ./sample.sh pass The script is not getting executed and says "integer expression expected" Could anyone kindly help me? (2 Replies)
Discussion started by: badrimohanty
2 Replies

7. Shell Programming and Scripting

Conditional Shell Statement

I want to add a conditional statement to a user's .profile file. I have a certain number of users that log in and use the rksh (Restricted Korn Shell). When they log in, it starts a certain program and when they exit this program, the system logs them out. When they are in this program, they can... (2 Replies)
Discussion started by: rjulich
2 Replies

8. Shell Programming and Scripting

Conditional IF statement with a wildcard

I'm trying to create a shell script that will check for new files and or folders and if it exist then copy them to a different directory. Does anyone have a idea? if ; then echo "Copying files from the Upgrade Server" cp -Ruavp /home/upgrade/hex-code/*... (7 Replies)
Discussion started by: binary-ninja
7 Replies

9. Shell Programming and Scripting

Conditional statement in SFTP

Hi, I wanted to know if we can use conditional statements like if--else--fi inside an automated SFTP script session. (1 Reply)
Discussion started by: jhilmil
1 Replies

10. Programming

Getting error at conditional statement.

Hi experts, I am doing an exercise which has the following requirements. Charlie will bite your finger exactly 50% of the time. First, write a function isBitten() that returns TRUE with 50% probability, and FALSE otherwise To generate a webpage that displays "Charlie bit your finger!" or... (1 Reply)
Discussion started by: Navneet_das_123
1 Replies
MACE4(1)						      General Commands Manual							  MACE4(1)

NAME
mace4 - searches for finite countermodels of first-order statements SYNOPSIS
mace4 [options] < input-file > output-file DESCRIPTION
This manual page documents briefly the mace4 command. The program mace4 searches for finite structures satisfying first-order and equational statements, the same kind of statement that prover9(1) accepts. If the statement is the denial of some conjecture, any structures found by mace4 are counterexamples to the conjecture. mace4 can be a valuable complement to prover9(1), looking for counterexamples before (or at the same time as) using prover9(1) to search for a proof. It can also be used to help debug input clauses and formulas for prover9(1). OPTIONS
A summary of options is included below. Options override the equivalent settings given in the input file. To set or clear a flag, you must give 1 or 0 as the value. -help This tells mace4 to print a summary of these command-line options. -n n This gives the starting domain size for the search. The default value is 2. If you also give an -N option, mace4 will iterate domain sizes up through the -N value, using an increment given by the -I value. Otherwise, mace4 will search only for the -n value. -N n This gives the ending domain size for the search. The default is 10. -i n This gives the domain size increment for the search. The default is 1. -q n This flag overrides the parameter iterate. It says to try the sizes that are prime numbers, from -n up through -N. -m n Stop searching when the nth structure has been found. The default is 1. -t n Stop searching after n seconds. -s n Allow at most n seconds for each domain size. The parameter can be used (together with -t) to give an overall time limit. -b n Stop searching when (about) n megabytes of memory have been used. -V n A rule is needed for distinguishing variables from constants in clauses and formulas with free variables. If this flag is clear, variables start with (lower case) `u' through `z'. If this flag is set, variables in clauses start with (upper case) `A' through `Z' or `_'. -P n If this flag is set, all structures that are found are printed in `standard' form, which means they are suitable as input to other LADR programs such as isofilter(1) and interpformat(1). -p n If this flag is set, and if -P is clear, all structures that are found are printed in a tabular form. -R n If this flag is set, a ring structure is is applied to the search. The operations {+,-,*} are assumed to be the ring of integers (mod domain_size). This method puts a tight constraint on the search, allowing much larger structures to be investigated. -v n If this flag is set, the output file receives information about the search, including the initial partial model (the part of the model that can be determined before backtracking starts) and timing and other statistics for each domain size. (It does not give a trace of the backtracking, so it does not consume a lot of file space.) -T n If the trace flag is set, detailed information about the search, including a trace of all assignments and backtracking, is printed to the standard output. This flag causes a lot of output, so it should be used only on small searches. There also exist a number of advanced options, which are used for experimentation with search methods. They can be ignored by nearly all users. For descriptions of these options, see the original mace4 manual. SEE ALSO
prover9(1). Full documentation for mace4 is found in the prover9 manual, available on Debian systems in the prover9-doc package at /usr/share/doc/prover9-doc/manual/index.html. The original mace4 manual, which can be downloaded at http://www.cs.unm.edu/~mccune/prover9/mace4.pdf AUTHOR
mace4 was written by William McCune <mccune@cs.unm.edu> This manual page was written by Peter Collingbourne <peter@pcc.me.uk>, for the Debian project (but may be used by others). August 12, 2007 MACE4(1)
All times are GMT -4. The time now is 11:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy