09-13-2019
You lost me there...can you post the entire script, along with how you intend for it to be called?
You could also add a "set -x" line before your 'if' statement so you can see what values it's comparing to see if it's what you expect.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
How can I use a variable that has the conditions for the if statement stored in it?
my test script
condition=" || || "
if "$condition"
then echo "true"
else echo "false"
fi
output
$ ./test2.sh
./test2.sh: line 3: || || : command not found
false (2 Replies)
Discussion started by: curlee2002
2 Replies
2. Shell Programming and Scripting
Hi All,
I am trying to check if two variables have value assigned to it.
i am doing it like
if ]
then
echo "Please specify either single hostname or host file for the report"
usage
exit
fi
But its not working for it.Even i specify values for both variables it dont go... (6 Replies)
Discussion started by: kailash19
6 Replies
3. Programming
Hi, I have meaning to include an if condition statement in my code to check the directory for existing output files and if its existing i want the program to delete it before doing the succeeding command. i just dont know the correct syntax for it. thanks much guys, this forum has indeed been very... (4 Replies)
Discussion started by: ida1215
4 Replies
4. Red Hat
Urgent help with bash scripting
1- i am using grep to find a string called: tinker panic 0 in a file /etc/ntp.conf
if the string is not there, i want to add the strings in /etc/ntp.conf file in the first line of the file. if not do nothing or exit.
2- also i want to add # in front of the... (2 Replies)
Discussion started by: lamoul
2 Replies
5. UNIX for Dummies Questions & Answers
I want to check (using bash condition test function) if string contains three spaces, ignoring last three spaces at the end of string.
string_to_report='foo bar foo bar '
string_to_ignore='foo bar ' (8 Replies)
Discussion started by: useretail
8 Replies
6. Shell Programming and Scripting
In the below I can not seem to add a line that will add Not low if the statement in bold is not true or meet. I guess when the first if statement is true/meet then print low, otherwise print Not low in $(NF + 1). I am not sure how to correctly add this. Thank you :).
if(low <= $2 && $2 <=... (5 Replies)
Discussion started by: cmccabe
5 Replies
7. Shell Programming and Scripting
issue is with .txt files (7 Replies)
Discussion started by: anil529
7 Replies
8. Shell Programming and Scripting
Hi,
I need to perform the untar and rm operation if the file found is a .tar and does not have test.tar or hello.tar as the file names.
Below is the loop to check the same.
for tf in *.tar
do if ]
then found=1
... (1 Reply)
Discussion started by: mohtashims
1 Replies
9. Shell Programming and Scripting
I wrote a code to find codons in a DNA string. The only problem I have is how do I make the code only work for a file with DNA. This means the file only has the characters a,c,g,t and no white space characters. (3 Replies)
Discussion started by: germany1517
3 Replies
10. UNIX for Beginners Questions & Answers
Hi.
I wrote this small bash script, i want to compare second column from file1 with file2 if a pattern matches. Files are small and I am sure that pattern occurs only once. I think this can be rewritten into a awk one liner. Appreciate if someone could give me idea. Whole NR FNR confuse me :o
... (6 Replies)
Discussion started by: ctrld
6 Replies
LEARN ABOUT DEBIAN
perl::critic::policy::modules::requireexplicitpackage
Perl::Critic::Policy::Modules::RequireExplicitPackage(3pUser Contributed Perl DocumentatPerl::Critic::Policy::Modules::RequireExplicitPackage(3pm)
NAME
Perl::Critic::Policy::Modules::RequireExplicitPackage - Always make the "package" explicit.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
In general, the first statement of any Perl module or library should be a "package" statement. Otherwise, all the code that comes before
the "package" statement is getting executed in the caller's package, and you have no idea who that is. Good encapsulation and common
decency require your module to keep its innards to itself.
There are some valid reasons for not having a "package" statement at all. But make sure you understand them before assuming that you
should do it too.
The maximum number of violations per document for this policy defaults to 1.
CONFIGURATION
As for programs, most people understand that the default package is "main", so this Policy doesn't apply to files that begin with a perl
shebang. If you want to require an explicit "package" declaration in all files, including programs, then add the following to your
.perlcriticrc file
[Modules::RequireExplicitPackage]
exempt_scripts = 0
Some users may find it desirable to exempt the load of specific modules from this policy. For example, Perl does not support Unicode module
names because of portability problems. Users who are not concerned about this and intend to use "UTF-8" module names will need to specify
"use utf8;" before the package declaration. To do this, add the following to your .perlcriticrc file
[Modules::RequireExplicitPackage]
allow_import_of = utf8
The "allow_import_of" configuration option takes multiple module names, separated by spaces.
IMPORTANT CHANGES
This policy was formerly called "ProhibitUnpackagedCode" which sounded a bit odd. If you get lots of "Cannot load policy module" errors,
then you probably need to change "ProhibitUnpackagedCode" to "RequireExplicitPackage" in your .perlcriticrc file.
AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
COPYRIGHT
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license
can be found in the LICENSE file included with this module.
perl v5.14.2 2012-06-07 Perl::Critic::Policy::Modules::RequireExplicitPackage(3pm)