Sponsored Content
Top Forums Shell Programming and Scripting Test File Existance Remotely? Post 302348606 by twk on Friday 28th of August 2009 05:38:57 PM
Old 08-28-2009
I've been trying to do the same thing in a script that goes out to many servers to check on the existence of a particular file or directory. The problem I have is that I need to respond to the "enter password" prompt and using a "here document" to supply the password will not work for this. Is there anyway I can respond to the prompt in the script automatically?

Thanks....
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File existance

Guys Iam trying to do a script to find what files are missing in particular directory.I came up with this for i in file6 file7 file8 file9 file10 file11 file12; do if ; then echo " $file not in /mnt/Server/base/i386/ " else echo " $file ... " fi done Iam trying to print... (2 Replies)
Discussion started by: coolkid
2 Replies

2. UNIX for Dummies Questions & Answers

Checking file existance by extension

I'm sure this can't be too tough, but. I want to check the existance of file(s) by extension. There may be 0,1,N files. If any files exist, then remove them. Thanks for any insight. (3 Replies)
Discussion started by: niswonp
3 Replies

3. Shell Programming and Scripting

check the file existance

Hello, I have two files .. 1. inventory_i.txt 2. inventory_b.txt I want to check if these two files exists. If exists, then do the process, otherwise, quite... if ; then echo "exists" else echo " does not exists" fi The above logic is not working... It is always, displaying Does... (2 Replies)
Discussion started by: govindts
2 Replies

4. UNIX for Advanced & Expert Users

speed test +20,000 file existance checks too slow

Need to make a very fast file existence checker. Passing in 20-50K num of files In the code below ${file} is a file with a listing of +20,000 files. test_speed is the script. I am commenting out the results of <time test_speed try>. The normal "test -f" is much much too slow when a system... (2 Replies)
Discussion started by: nullwhat
2 Replies

5. UNIX for Dummies Questions & Answers

Test existance of a file

Hi, I need to find out if a particular file exists and i am using if with -e option. Scenarion is like There is a possibility of two files having nomaincluture like below First file = abc20101028.somthing Second File = abc20101028.somthing.done I need to check abc20101028.somthing... (1 Reply)
Discussion started by: siba.s.nayak
1 Replies

6. Shell Programming and Scripting

Scripting to check the size of file and it's existance.

Hi, I am totaly new to create a script . Please help. I have file name retrived from SAP table into a internal table . Like :- /home/td_8d02_int_data_IPCL/ILLUSTRATIONS/CGM/l_pc_112138_01_0_01_00.cgm /home/td_8d02_int_data_IPC-L/ILLUSTRATIONS/CMP/l_pc_112138_01_0_01_00.cmp Objective... (1 Reply)
Discussion started by: amitkumar.b2
1 Replies

7. Shell Programming and Scripting

[Solved] Know the existance of a file on remote server

In a Korn shell, I want to test whether a file exists on a remote shell. If I use ssh <Remote server> ls abc It gives file proper result, but unable to capture in the script. Any help? Thanks Please use next time code tags for your code and data (3 Replies)
Discussion started by: Soham
3 Replies

8. Shell Programming and Scripting

Error while checking file existance

Kindly help on below script: << i='find ...' if then echo 'File Exists' else echo 'File Does Not Exist' >> If i has some file name then it runs properly but if i has nothing ( blank value) then it throws an error. I dont exactly remember right now but error seems like:... (2 Replies)
Discussion started by: ravigupta2u
2 Replies

9. Shell Programming and Scripting

Csh/tcsh : Check the file existance and run the script

Hi, I've to wait until a file generated and once its generated, source another script in Linux terminal. Please help me as this is very very urgent. The code should be something like if ( -e "/abc/xyz/a.txt ) source aaa.csh else sleep This should be repeated till the if... (4 Replies)
Discussion started by: kumar_eee
4 Replies

10. Shell Programming and Scripting

Checking Multiple File existance in a UNIX folder(Note: File names are all different)

HI Guys, I have some 8 files with different name and extensions. I need to check if they are present in a specific folder or not and also want that script to show me which all are not present. I can write if condition for each file but from a developer perspective , i feel that is not a good... (3 Replies)
Discussion started by: shankarpanda003
3 Replies
Test::Strict(3pm)					User Contributed Perl Documentation					 Test::Strict(3pm)

NAME
Test::Strict - Check syntax, presence of use strict; and test coverage SYNOPSIS
"Test::Strict" lets you check the syntax, presence of "use strict;" and presence "use warnings;" in your perl code. It report its results in standard "Test::Simple" fashion: use Test::Strict tests => 3; syntax_ok( 'bin/myscript.pl' ); strict_ok( 'My::Module', "use strict; in My::Module" ); warnings_ok( 'lib/My/Module.pm' ); Module authors can include the following in a t/strict.t and have "Test::Strict" automatically find and check all perl files in a module distribution: use Test::Strict; all_perl_files_ok(); # Syntax ok and use strict; or use Test::Strict; all_perl_files_ok( @mydirs ); "Test::Strict" can also enforce a minimum test coverage the test suite should reach. Module authors can include the following in a t/cover.t and have "Test::Strict" automatically check the test coverage: use Test::Strict; all_cover_ok( 80 ); # at least 80% coverage or use Test::Strict; all_cover_ok( 80, 't/' ); DESCRIPTION
The most basic test one can write is "does it compile ?". This module tests if the code compiles and play nice with "Test::Simple" modules. Another good practice this module can test is to "use strict;" in all perl files. By setting a minimum test coverage through "all_cover_ok()", a code author can ensure his code is tested above a preset level of kwality throughout the development cycle. Along with Test::Pod, this module can provide the first tests to setup for a module author. This module should be able to run under the -T flag for perl >= 5.6. All paths are untainted with the following pattern: "qr|^([-+@w./:\]+)$|" controlled by $Test::Strict::UNTAINT_PATTERN. FUNCTIONS
syntax_ok( $file [, $text] ) Run a syntax check on $file by running "perl -c $file" with an external perl interpreter. The external perl interpreter path is stored in $Test::Strict::PERL which can be modified. You may prefer "use_ok()" from Test::More to syntax test a module. For a module, the path (lib/My/Module.pm) or the name (My::Module) can be both used. strict_ok( $file [, $text] ) Check if $file contains a "use strict;" statement. "use Moose" and "use Mouse" are also considered valid. This is a pretty naive test which may be fooled in some edge cases. For a module, the path (lib/My/Module.pm) or the name (My::Module) can be both used. warnings_ok( $file [, $text] ) Check if warnings have been turned on. If $file is a module, check if it contains a "use warnings;" or "use warnings::..." or "use Moose" or "use Mouse" statement. If the perl version is <= 5.6, this test is skipped ("use warnings" appeared in perl 5.6). If $file is a script, check if it starts with "#!...perl -w". If the -w is not found and perl is >= 5.6, check for a "use warnings;" or "use warnings::..." or "use Moose" or "use Mouse" statement. This is a pretty naive test which may be fooled in some edge cases. For a module, the path (lib/My/Module.pm) or the name (My::Module) can be both used. all_perl_files_ok( [ @directories ] ) Applies "strict_ok()" and "syntax_ok()" to all perl files found in @directories (and sub directories). If no <@directories> is given, the starting point is one level above the current running script, that should cover all the files of a typical CPAN distribution. A perl file is *.pl or *.pm or *.t or a file starting with "#!...perl" If the test plan is defined: use Test::Strict tests => 18; all_perl_files_ok(); the total number of files tested must be specified. You can control which tests are run on each perl site through: $Test::Strict::TEST_SYNTAX (default = 1) $Test::Strict::TEST_STRICT (default = 1) $Test::Strict::TEST_WARNINGS (default = 0) $Test::Strict::TEST_SKIP (default = []) "Trusted" files to skip all_cover_ok( [coverage_threshold [, @t_dirs]] ) This will run all the tests in @t_dirs (or current script's directory if @t_dirs is undef) under Devel::Cover and calculate the global test coverage of the code loaded by the tests. If the test coverage is greater or equal than "coverage_threshold", it is a pass, otherwise it's a fail. The default coverage threshold is 50 (meaning 50% of the code loaded has been covered by test). The threshold can be modified through $Test::Strict::COVERAGE_THRESHOLD. You may want to select which files are selected for code coverage through $Test::Strict::DEVEL_COVER_OPTIONS, see Devel::Cover for the list of available options. The default is '+ignore,"/Test/Strict"'. The path to "cover" utility can be modified through $Test::Strict::COVER. The 50% threshold is a completely arbitrary value, which should not be considered as a good enough coverage. The total coverage is the return value of "all_cover_ok()". CAVEATS
For "all_cover_ok()" to work properly, it is strongly advised to install the most recent version of Devel::Cover and use perl 5.8.1 or above. In the case of a "make test" scenario, "all_perl_files_ok()" re-run all the tests in a separate perl interpreter, this may lead to some side effects. SEE ALSO
Test::More, Test::Pod. Test::Distribution, <Test:NoWarnings> AUTHOR
Pierre Denis, "<pdenis@gmail.com>". COPYRIGHT
Copyright 2005, 2010 Pierre Denis, All Rights Reserved. You may use, modify, and distribute this package under the same terms as Perl itself. perl v5.10.1 2010-02-14 Test::Strict(3pm)
All times are GMT -4. The time now is 02:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy