Sponsored Content
Top Forums Shell Programming and Scripting File check script fails for multiple files Post 302763731 by Yoda on Wednesday 30th of January 2013 11:44:47 AM
Old 01-30-2013
Another approach:
Code:
if ls /tmp/file_checker/testing*.txt > /dev/null 2> /dev/null; then
echo "TEST21"
fi

This User Gave Thanks to Yoda For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

check the file in multiple Directory in a script

hi, i want to write the script to list atleast one file inside that directory eg: /home/Log/amp01 /home/log/amp02 . . . /home/log/amp..N want to see atleast one file inside the /home/log/amp01 .... amp(N) if it not there.. need to give that no file exists inside... (3 Replies)
Discussion started by: mail2sant
3 Replies

2. Shell Programming and Scripting

1 script or multiple scripts?? - check files, run jobs

Question for anyone that might be able to help: My objective is to eheck if a file (a source file) exists in a directory. If it does then, I'd like to call an application (Informatica ETL file...not necessary to know) to run a program which extracts data and loads it into multiple targets. ... (6 Replies)
Discussion started by: jnanasakti
6 Replies

3. Shell Programming and Scripting

.sh script / Check for file in two directories then cat the files

Hi, Here is what i'm trying to do, -Check in two directories for a user inputed filename -Then cat all the version found of the file to the current screen I am a total nembie to programming, here what i have done so far.... #!/bin/bash #Check in /home/loonatic and /var/named/master... (2 Replies)
Discussion started by: Loonatic
2 Replies

4. Shell Programming and Scripting

need a shell script to extract the files from source file and check whether those files existonserve

Hi, I am new to shell scripting.Please help me on this.I am using solaris 10 OS and shell i am using is # echo $0 -sh My requirement is i have source file say makefile.I need to extract files with extensions (.c |.cxx |.h |.hxx |.sc) from the makefile.after doing so i need to check whether... (13 Replies)
Discussion started by: muraliinfy04
13 Replies

5. Shell Programming and Scripting

Except script fails to check file exists or not in remote node

Dear members, The following expect script connects to remote node and check for the file "authorized_keys" in directory /root/.ssh in remote node. However the result is always found even if the file exist or doesn't exist. expect { "$fname" { send_user "found\n" } Any idea what is... (4 Replies)
Discussion started by: Sudhakar333
4 Replies

6. Homework & Coursework Questions

Script performs the right task but fails against check

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write a script checkFiles.sh that takes an arbitrary number of file paths from the command line and carries ... (5 Replies)
Discussion started by: Ezraek
5 Replies

7. Shell Programming and Scripting

Check file from multiple files is empty using awk

I am passing multiple files in awk & since one of the file is empty(say file3) so the same gets skipped & logic goes for toss. Need suggestion/help in checking and putting additional checks for the same awk -F, 'FNR==1 {++filecounter} filecounter==1 {KRL=$2;next} filecounter==2... (8 Replies)
Discussion started by: siramitsharma
8 Replies

8. Shell Programming and Scripting

Shell script to check a file and delete old files

Hello, I needed help with a shell script where in it checks if a file exists under a directory and also checks the age of the file and delete it if it is older than 3 weeks. thanks (10 Replies)
Discussion started by: hasn318
10 Replies

9. UNIX for Beginners Questions & Answers

Need in for a script that should check for errors in multiple log file (approx 2500) and should mail

hello everyone, I am new to linux and got this deliverable to write a script that should check for error in multiple log file (count is approx 2500 log files on single server) and once error is found, it should mail that error My logic says: we can put all log files path/location in one... (2 Replies)
Discussion started by: Pratik_CTS
2 Replies

10. Shell Programming and Scripting

Shell script to check current date file is created and with >0 kb or not for multiple directories

Hi All, I am new in scripting and working in a project where we have RSyslog servers over CentOS v7 and more than 200 network devices are sending logs to each RSyslog servers. For each network devices individual folders create on the name of the each network devices IP addresses.The main... (7 Replies)
Discussion started by: Pinaki
7 Replies
Test::Compile(3pm)					User Contributed Perl Documentation					Test::Compile(3pm)

NAME
Test::Compile - Check whether Perl module files compile correctly SYNOPSIS
#!perl -w use strict; use warnings; use Test::Compile; all_pm_files_ok(); DESCRIPTION
"Test::Compile" lets you check the validity of a Perl module file or Perl script file, and report its results in standard "Test::Simple" fashion. BEGIN { use Test::Compile tests => $num_tests; pm_file_ok($file, "Valid Perl module file"); } It's probably a good idea to run this in a BEGIN block. The examples below omit it for clarity. Module authors can include the following in a t/00_compile.t file and have "Test::Compile" automatically find and check all Perl module files in a module distribution: use Test::More; eval "use Test::Compile 0.09"; Test::More->builder->BAIL_OUT( "Test::Compile 0.09 required for testing compilation") if $@; all_pm_files_ok(); You can also specify a list of files to check, using the "all_pm_files()" function supplied: use strict; use Test::More; eval "use Test::Compile 0.09"; Test::More->builder->BAIL_OUT( "Test::Compile 0.09 required for testing compilation") if $@; my @pmdirs = qw(blib script); all_pm_files_ok(all_pm_files(@pmdirs)); Or even (if you're running under Apache::Test): use strict; use Test::More; eval "use Test::Compile 0.09"; Test::More->builder->BAIL_OUT( "Test::Compile 0.09 required for testing compilation") if $@; my @pmdirs = qw(blib script); use File::Spec::Functions qw(catdir updir); all_pm_files_ok( all_pm_files(map { catdir updir, $_ } @pmdirs) ); Why do the examples use "BAIL_OUT()" instead of "skip_all()"? Because testing whether a module compiles is important. "skip_all()" is ok to use with Test::Pod, because if the pod is malformed the program is still going to run. But checking whether a module even compiles is something else. Test::Compile should be mandatory, not optional. FUNCTIONS
"pm_file_ok(FILENAME[, TESTNAME ])" "pm_file_ok()" will okay the test if the Perl module compiles correctly. When it fails, "pm_file_ok()" will show any compilation errors as diagnostics. The optional second argument "TESTNAME" is the name of the test. If it is omitted, "pm_file_ok()" chooses a default test name "Compile test for FILENAME". "pl_file_ok(FILENAME[, TESTNAME ])" "pl_file_ok()" will okay the test if the Perl script compiles correctly. You need to give the path to the script relative to this distribution's base directory. So if you put your scripts in a 'top-level' directory called script the argument would be "script/filename". When it fails, "pl_file_ok()" will show any compilation errors as diagnostics. The optional second argument "TESTNAME" is the name of the test. If it is omitted, "pl_file_ok()" chooses a default test name "Compile test for FILENAME". "all_pm_files_ok([@files/@directories])" Checks all the files in @files for compilation. It runs all_pm_files() on each file/directory, and calls the "plan()" function for you (one test for each function), so you can't have already called "plan". If @files is empty or not passed, the function finds all Perl module files in the blib directory if it exists, or the lib directory if not. A Perl module file is one that ends with .pm. If you're testing a module, just make a t/00_compile.t: use Test::More; eval "use Test::Compile 0.09"; plan skip_all => "Test::Compile 0.09 required for testing compilation" if $@; all_pm_files_ok(); Returns true if all Perl module files are ok, or false if any fail. Or you could just let Module::Install::StandardTests do all the work for you. "all_pl_files_ok([@files])" Checks all the files in @files for compilation. It runs pl_file_ok() on each file, and calls the "plan()" function for you (one test for each file), so you can't have already called "plan". If @files is empty or not passed, the function uses all_pl_files() to find scripts to test If you're testing a module, just make a t/00_compile_scripts.t: use Test::More; eval "use Test::Compile 0.09"; plan skip_all => "Test::Compile 0.09 required for testing compilation" if $@; all_pl_files_ok(); Returns true if all Perl module files are ok, or false if any fail. "all_pm_files([@dirs])" Returns a list of all the perl module files - that is, files ending in .pm - in $dir and in directories below. If no directories are passed, it defaults to blib if blib exists, or else lib if not. Skips any files in "CVS" or ".svn" directories. The order of the files returned is machine-dependent. If you want them sorted, you'll have to sort them yourself. "all_pl_files([@files/@dirs])" Returns a list of all the perl script files - that is, files ending in .pl or with no extension. Directory arguments are searched recursively . If arguments are passed, it defaults to script if script exists, or else bin if bin exists. Skips any files in "CVS" or ".svn" directories. The order of the files returned is machine-dependent. If you want them sorted, you'll have to sort them yourself. AUTHORS
Sagar R. Shah "<srshah@cpan.org>", Marcel Gruenauer, "<marcel@cpan.org>", Evan Giles, "<egiles@cpan.org>" COPYRIGHT AND LICENSE
Copyright 2007-2012 by the authors. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Test::LoadAllModules just handles modules, not script files, but has more fine-grained control. perl v5.14.2 2012-02-27 Test::Compile(3pm)
All times are GMT -4. The time now is 01:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy