Hi All,
While I am trying to run below code I Am getting the exception like
./abs.sh: line 102: syntax error near unexpected token `then'
./abs.sh: line 102: ` then'
The Code Snippet is:
if then
cat $file1 | sed -e... (8 Replies)
i have a string in a file which gets repeated number of times like below:
rpttxt("abc")
.
.
rpttxt("REP_TITLE")
rpttxt("BOS_TITLE")
.
.
.
.
and so on
using awk or grep how can i comapre the string( as the second half keeps varying) and store it in a temporary variable? I am using the... (3 Replies)
hi All
i am facing prob in comparing two strings that have two word.
below is the code snippet.
checkValidates="file validates"
file3_name="file"
if
then
echo "file" $file3_name "is validated successfully"
fi
when i run this i get the error as -bash: [: too many arguments
... (1 Reply)
Hello All
Please I have got a file called DATE.tex which consist of
01-04-2008_12:00:00
01-04-2005_12:00:00
01-04-2003_12:00:00
01-04-2007_12:00:00
01-04-2002_12:00:00
01-04-2009_12:00:00
I want to use nawk to print out the dates >=01-04-2009_12:00:00
I tried this
cat plnt.new |... (6 Replies)
Hello I'm very new to Linux and shell scripting so I only know basic stuff. I'm making a script with the purpose of finding the longest string or word in a file. Here's what I got so far:
#!/bin/bash
longest=""
for i in $(strings -n $1); do
if ]
then
longest=$i
fi
done
echo $longest... (4 Replies)
Hi, So I got his code below. $year is a string of 2010,2011 etc.
I guess I want to convert $year to an integer so I can do my if statement to see if the year string is greater than 2010? Or how could I do this?
Right now I get a syntax error doing this.
if; then
do stuff
fi (2 Replies)
Hi I tried the following string comparison script in Ksh88
#!/bin/ksh
str1='aC'
str2='ABC'
if
then
echo "Equal"
else
echo "Not Equal"
fi
Though str1 and str2 are not equal the script output says Equal .
Please correct me
Thanks (2 Replies)
Perl::Critic::Policy::ControlStructures::ProhibitCascadiUserEContributed Perl DPerl::Critic::Policy::ControlStructures::ProhibitCascadingIfElse(3)NAME
Perl::Critic::Policy::ControlStructures::ProhibitCascadingIfElse - Don't write long "if-elsif-elsif-elsif-elsif...else" chains.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Long "if-elsif" chains are hard to digest, especially if they are longer than a single page or screen. If testing for equality, use a hash
lookup instead. If you're using perl 5.10 or later, use "given"/"when".
if ($condition1) { #ok
$foo = 1;
}
elsif ($condition2) { #ok
$foo = 2;
}
elsif ($condition3) { #ok
$foo = 3;
}
elsif ($condition4) { #too many!
$foo = 4;
}
else { #ok
$foo = $default;
}
CONFIGURATION
This policy can be configured with a maximum number of "elsif" alternatives to allow. The default is 2. This can be specified via a
"max_elsif" item in the .perlcriticrc file:
[ControlStructures::ProhibitCascadingIfElse]
max_elsif = 3
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.16.3 2014-06-09 Perl::Critic::Policy::ControlStructures::ProhibitCascadingIfElse(3)