Sponsored Content
Top Forums UNIX for Dummies Questions & Answers List of 'if -f' options - AIX / Korn Shell Post 302594810 by methyl on Wednesday 1st of February 2012 08:51:05 AM
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:
 

10 More Discussions You Might Find Interesting

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

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

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

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

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

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

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

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

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

10. 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
Module::Load::Conditional(3pm)				 Perl Programmers Reference Guide			    Module::Load::Conditional(3pm)

NAME
Module::Load::Conditional - Looking up module information / loading at runtime SYNOPSIS
use Module::Load::Conditional qw[can_load check_install requires]; my $use_list = { CPANPLUS => 0.05, LWP => 5.60, 'Test::More' => undef, }; print can_load( modules => $use_list ) ? 'all modules loaded successfully' : 'failed to load required modules'; my $rv = check_install( module => 'LWP', version => 5.60 ) or print 'LWP is not installed!'; print 'LWP up to date' if $rv->{uptodate}; print "LWP version is $rv->{version} "; print "LWP is installed as file $rv->{file} "; print "LWP requires the following modules to be installed: "; print join " ", requires('LWP'); ### allow M::L::C to peek in your %INC rather than just ### scanning @INC $Module::Load::Conditional::CHECK_INC_HASH = 1; ### reset the 'can_load' cache undef $Module::Load::Conditional::CACHE; ### don't have Module::Load::Conditional issue warnings -- ### default is '1' $Module::Load::Conditional::VERBOSE = 0; ### The last error that happened during a call to 'can_load' my $err = $Module::Load::Conditional::ERROR; DESCRIPTION
Module::Load::Conditional provides simple ways to query and possibly load any of the modules you have installed on your system during runtime. It is able to load multiple modules at once or none at all if one of them was not able to load. It also takes care of any error checking and so forth. Methods $href = check_install( module => NAME [, version => VERSION, verbose => BOOL ] ); "check_install" allows you to verify if a certain module is installed or not. You may call it with the following arguments: module The name of the module you wish to verify -- this is a required key version The version this module needs to be -- this is optional verbose Whether or not to be verbose about what it is doing -- it will default to $Module::Load::Conditional::VERBOSE It will return undef if it was not able to find where the module was installed, or a hash reference with the following keys if it was able to find the file: file Full path to the file that contains the module dir Directory, or more exact the @INC entry, where the module was loaded from. version The version number of the installed module - this will be "undef" if the module had no (or unparsable) version number, or if the variable $Module::Load::Conditional::FIND_VERSION was set to true. (See the "GLOBAL VARIABLES" section below for details) uptodate A boolean value indicating whether or not the module was found to be at least the version you specified. If you did not specify a version, uptodate will always be true if the module was found. If no parsable version was found in the module, uptodate will also be true, since "check_install" had no way to verify clearly. See also $Module::Load::Conditional::DEPRECATED, which affects the outcome of this value. $bool = can_load( modules => { NAME => VERSION [,NAME => VERSION] }, [verbose => BOOL, nocache => BOOL] ) "can_load" will take a list of modules, optionally with version numbers and determine if it is able to load them. If it can load *ALL* of them, it will. If one or more are unloadable, none will be loaded. This is particularly useful if you have More Than One Way (tm) to solve a problem in a program, and only wish to continue down a path if all modules could be loaded, and not load them if they couldn't. This function uses the "load" function from Module::Load under the hood. "can_load" takes the following arguments: modules This is a hashref of module/version pairs. The version indicates the minimum version to load. If no version is provided, any version is assumed to be good enough. verbose This controls whether warnings should be printed if a module failed to load. The default is to use the value of $Module::Load::Conditional::VERBOSE. nocache "can_load" keeps its results in a cache, so it will not load the same module twice, nor will it attempt to load a module that has already failed to load before. By default, "can_load" will check its cache, but you can override that by setting "nocache" to true. @list = requires( MODULE ); "requires" can tell you what other modules a particular module requires. This is particularly useful when you're intending to write a module for public release and are listing its prerequisites. "requires" takes but one argument: the name of a module. It will then first check if it can actually load this module, and return undef if it can't. Otherwise, it will return a list of modules and pragmas that would have been loaded on the module's behalf. Note: The list "require" returns has originated from your current perl and your current install. Global Variables The behaviour of Module::Load::Conditional can be altered by changing the following global variables: $Module::Load::Conditional::VERBOSE This controls whether Module::Load::Conditional will issue warnings and explanations as to why certain things may have failed. If you set it to 0, Module::Load::Conditional will not output any warnings. The default is 0; $Module::Load::Conditional::FIND_VERSION This controls whether Module::Load::Conditional will try to parse (and eval) the version from the module you're trying to load. If you don't wish to do this, set this variable to "false". Understand then that version comparisons are not possible, and Module::Load::Conditional can not tell you what module version you have installed. This may be desirable from a security or performance point of view. Note that $FIND_VERSION code runs safely under "taint mode". The default is 1; $Module::Load::Conditional::CHECK_INC_HASH This controls whether "Module::Load::Conditional" checks your %INC hash to see if a module is available. By default, only @INC is scanned to see if a module is physically on your filesystem, or available via an "@INC-hook". Setting this variable to "true" will trust any entries in %INC and return them for you. The default is 0; $Module::Load::Conditional::CACHE This holds the cache of the "can_load" function. If you explicitly want to remove the current cache, you can set this variable to "undef" $Module::Load::Conditional::ERROR This holds a string of the last error that happened during a call to "can_load". It is useful to inspect this when "can_load" returns "undef". $Module::Load::Conditional::DEPRECATED This controls whether "Module::Load::Conditional" checks if a dual-life core module has been deprecated. If this is set to true "check_install" will return false to "uptodate", if a dual-life module is found to be loaded from $Config{privlibexp} The default is 0; See Also "Module::Load" BUG REPORTS
Please report bugs or other issues to <bug-module-load-conditional@rt.cpan.org>. AUTHOR
This module by Jos Boumans <kane@cpan.org>. COPYRIGHT
This library is free software; you may redistribute and/or modify it under the same terms as Perl itself. perl v5.16.2 2012-10-25 Module::Load::Conditional(3pm)
All times are GMT -4. The time now is 11:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy