Sponsored Content
Full Discussion: Tip: file_exists function
Top Forums Shell Programming and Scripting Tip: file_exists function Post 302921891 by sea on Monday 20th of October 2014 09:39:05 PM
Old 10-20-2014
EDIT: Nevermind, thats the purpose of your script Smilie

Last edited by sea; 10-20-2014 at 10:51 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

one teaching Tip

Student have huge interest about why so many expert choose use UNIX than MS Windows. I consider that SHARE & OPEN is key point.:) (2 Replies)
Discussion started by: 111000
2 Replies

2. Solaris

tip into 280R

I need to use tip from machine A serial port to machine B serial port. Can someone point me to an example of the correct cable to use? Thanks. (1 Reply)
Discussion started by: dangral
1 Replies

3. Shell Programming and Scripting

Little bit of a help or just a tip

I am about to do a script that change the COST so i dont need to change each cost. The output looks like this. "OL_ID OL_LINK_COST ----------- ------------ 51 10 52 10 53 10 54 10 55 ... (3 Replies)
Discussion started by: maskot
3 Replies

4. UNIX for Advanced & Expert Users

if test -f $file_exists

Hi, I have a wiered problem probably unique to me. if test -f "${LOGDIRE}/Component_Name.sql" then echo "<br>Synchronization success<br>" else echo "<br>Sorry! Synchronizing failed" fi Considering, the file is present always, the above condition returns different outputs in each... (1 Reply)
Discussion started by: Nanu_Manju
1 Replies

5. Solaris

Solaris; tip

plz explain TIP in solaris in detail. (11 Replies)
Discussion started by: karman0931
11 Replies

6. Shell Programming and Scripting

Regexp tip

Hello, I'm just starting working on it. I'd like to get a tip For istance if I have a file like: a b c d e f .... and I wanna get: 1a & 2b & 3c 0d & 8e & 4f ..... I would like to use sed and come up with a regular expression that works.... (3 Replies)
Discussion started by: Dedalus
3 Replies

7. Shell Programming and Scripting

Search tip.

How do I find a key word in multiple files.. in a directory.. ? cat *.doc | grep -i myword? (7 Replies)
Discussion started by: hamon
7 Replies

8. Shell Programming and Scripting

Quick awk tip :)

how do i "awk" the date after the from only to compare it on a if statement later . filename example: server1-ips-ultranoob-ok_From_2012_21_12-23:40:23_To_2012_21_12-23:49:45.zip what i want o do is compare only the date from the string in "From_2012_21_12" in this case i only want the... (4 Replies)
Discussion started by: drd0spt
4 Replies

9. AIX

[TIP] Migration to POWER8

Read "Migration to POWER8" article to get prepared for migration to POWER8: link removed, advertisement (0 Replies)
Discussion started by: pave01
0 Replies

10. Shell Programming and Scripting

[Tip] A better echo

Often it has been said that echo is neither portable nor correct. Here is an input.txt: line1 line2 -n line4 -en line6 -x line8 Then the following fails with BSD/Linux/bash: while IFS= read line do echo "$line" done < input.txt It is elegantly improved by means of an echo... (2 Replies)
Discussion started by: MadeInGermany
2 Replies
test(1) 						      General Commands Manual							   test(1)

NAME
test - condition evaluation command SYNOPSIS
expr DESCRIPTION
The command evaluates the expression expr and, if its value is True, returns a zero (true) exit status; otherwise, a nonzero (false) exit status is returned. also returns a nonzero exit status if there are no arguments. The following primitives are used to construct expr: True if file exists and is readable. True if file exists and is writable. True if file exists and is executable. True if file exists and is a regular file. True if file exists and is a directory. True if file exists and is a character special file. True if file exists and is a block special file. True if file exists and is a named pipe (fifo). True if file exists and its set-user-ID bit is set. True if file exists and its set-group-ID bit is set. True if file exists and its sticky bit is set. True if file exists and has a size greater than zero. True if file exists and is a symbolic link. True if the open file whose file descriptor number is fildes (1 by default) is associated with a terminal device. True if the length of string s1 is zero. True if the length of the string s1 is non-zero. True if strings s1 and s2 are identical. True if strings s1 and s2 are not identical. s1 True if s1 is not the null string. True if the integers n1 and n2 are algebraically equal. Any of the comparisons and can be used in place of These primaries can be combined with the following operators: Unary negation operator. Binary AND operator. Binary OR operator has higher precedence than Parentheses for grouping. Note that all the operators and flags are separate arguments to Note also that parentheses are significant to the shell and therefore must be escaped. All file test operators return success if the argument is a symbolic link that points to a file of the file type being tested. is interpreted directly by the shell, and therefore does not exist as a separate executable program. EXTERNAL INFLUENCES
International Code Set Support Single byte and multibyte character code sets are supported. EXAMPLES
Exit if there are not two or three arguments: Create a new file containing the text string if the file does not already exist: Wait for myfile to become non-readable: WARNINGS
When the form of this command is used, the matching must be the final argument, and both must be separate arguments from the arguments they enclose (white space delimiters required. Parentheses and other special shell metacharacters intended to be handled by test must be escaped or quoted when invoking from a shell. Avoid such problems when comparing strings by inserting a non-operator character at the beginning of both operands: This approach does not work with numeric comparisons or the unary operators because it would affect the operand being checked. AUTHOR
was developed by the University of California, Berkeley and HP. SEE ALSO
find(1), sh-posix(1), sh(1). STANDARDS CONFORMANCE
test(1)
All times are GMT -4. The time now is 08:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy