List of 'if -f' options - AIX / Korn Shell


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers List of 'if -f' options - AIX / Korn Shell
# 1  
Old 02-01-2012
List of 'if -f' options - AIX / Korn Shell

Hi all,

Can someone point me in the right direction for a manual on the various statement options for 'if'. Basically I have a piece of code which says:

Code:
if [[ ! -f ${LIST_NEW}.csv ]]

and I wondered what the -f was. I know the '!' means not equal..

As usual any help much appreciated..

Last edited by methyl; 02-01-2012 at 09:47 AM.. Reason: please use code tags
# 2  
Old 02-01-2012
Code:
 
man test

This User Gave Thanks to itkamaraj For This Post:
# 3  
Old 02-01-2012
-f stands for if file exist when prefix with ! it implies if file not exist then ...
This User Gave Thanks to joshiamit For This Post:
# 4  
Old 02-01-2012
Quote:
if [[ ! -f ${LIST_NEW}.csv ]]
In ksh this not a "Test", it is a Conditional Expression.
They are described at length in "man ksh" in the section "Conditional Expressions".

There is much overlap in the syntax between a "Test" and a "Conditional Expression" but they are not the same.
This User Gave Thanks to methyl For This Post:
# 5  
Old 02-01-2012
There also is a difference between [[ ]] and [ ] - they are likewise not identical. For example, [[ ]] is a builtin, [ ] actually invokes test.
Therefore [[ ]] is more efficient.
This User Gave Thanks to jim mcnamara For This Post:
# 6  
Old 02-01-2012
In "ksh" [ ] does not invoke /usr/bin/test.
The whole of the test function is built into "ksh" plus a few more extensions. Only the extensions are documented in detail in "man ksh". The vast majority of the ksh "test" function is documented in "man test".
This User Gave Thanks to methyl For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Options for AIX server backups

Hello, I'm new to this forum. Forgive a question that may have been asked, but I would like to get advice on options for backups of an AIX server. The AIX server in question has about 2TB of storage, with 3 Oracle databases configured on it We're currently using tar backups to tape, LTO... (1 Reply)
Discussion started by: terrya
1 Replies

2. Shell Programming and Scripting

Help when using Typeset in AIX Korn Shell

Guys, please help! I am currently using an AIX server however whenever I tried to use the typeset -F3, the variable is resulting with a "#". In the given example below, I declared x to be a decimal holding 3 decimal places = 1.455. However whenever I tried to echo the $x, the resulting value... (9 Replies)
Discussion started by: zzavilz
9 Replies

3. Shell Programming and Scripting

Korn shell behaviour in AIX

Hi, Consider the code snippet below: fun() { while read x do echo $x done < somefile_that_does_not_exists } fun echo I am here Korn shell on HPUX prints the message "I am here", while the behaviour is different on AIX korn shell. We do not get the message on AIX. Any... (5 Replies)
Discussion started by: 116@434
5 Replies

4. Shell Programming and Scripting

Print pipe separated list as line by line in Korn Shell

Korn Shell in AIX 6.1 I want to print the below shown pipe (|) separated list line by line. line=es349889|nhb882309|ts00293|snh03524|bg578835|bg37900|rnh00297|py882201|sg175883 for i in line do echo "Hello $line " done I wanted to execute the above for loop. But i can't even set the... (3 Replies)
Discussion started by: polavan
3 Replies

5. Shell Programming and Scripting

Parsing the list in korn shell

Hi I wanted to print/store just a specific element of the list . I have got the list as an output of grep command. here is code snap below : end_no=`egrep -ni '!return code: 0|return code other than 0' temp.log | cut -d':' -f1` this will return the line numbers in end_no. I just... (2 Replies)
Discussion started by: Shell@korn
2 Replies

6. AIX

Any hope to get lp options like the following to work on AIX (6.1)?

Greetings Aix gurus, I have been appointed the task to port my SAS environment on HP-UX to AIX... I have been able to solve most issues but I am stuck with the following lines (these were easy to find, since in shell scripts but I found out that there are plenty more and encapsulated in SAS... (1 Reply)
Discussion started by: vbe
1 Replies

7. Shell Programming and Scripting

AIX Korn shell sed -s problem

In a Korn shell script I have, cat ../header | sed -e 's/flag1/$cnumb/g' > header.txt The header is short {{Company flag1}} But the result in header.txt is {{Company $cnumb}} The value of $cnumb is 120. I am trying to get the value of $cnumb into the header. I have tried /'$cnumb'/g,... (10 Replies)
Discussion started by: jcarrott
10 Replies

8. AIX

AIX 4.2 Korn shell and grep question

Ho do I find out the verion of the Kron shell on my client`s system ? There is no one to ask. They are not knowledged enough (hard to believe but yes). Also, on that AIX 4.2, I am trying to figure out how to do a grep using a search patter like below but does not seam to work. The '*' do... (11 Replies)
Discussion started by: Browser_ice
11 Replies

9. Shell Programming and Scripting

Mount options - AIX

I'm trying to write a script to verify that file systems mounted properly after a reboot or a script that any system admin can run to verify that all file systems are mounted properly. With HP-UX, I can run a mount -aQ and it will mount file systems not already mounted and report back any... (1 Reply)
Discussion started by: DRPearce
1 Replies

10. Shell Programming and Scripting

korn shell + sftp + list files

Hello!!! I need a korn shell script in AIX that inside sftp environment, changes a remote directory, lists the files inside it, and stores in an array. I got it working before make a sftp, but after.. I can't.. The way it is, it lists the files in local path... so.. not what I want, but... (1 Reply)
Discussion started by: alienET
1 Replies
Login or Register to Ask a Question