Sponsored Content
Top Forums Shell Programming and Scripting A question about if statement Post 302579129 by Dark2Bright on Sunday 4th of December 2011 11:11:00 PM
Old 12-05-2011
Code tags

I'm sorry. I tried to indent, but it seems that the space is automatically deleted. I will tried with your advice.
Thanks a lot.

---------- Post updated at 11:11 PM ---------- Previous update was at 11:03 PM ----------

I have another problem, If my code is like below:
Code:
verify()
{
// do something return $(grep -q 'VERIFICATION SUCCESSFUL' result.txt)
} if [ verify 'a Condition' ]; then
echo debug
fi

Then I have the following error:
Code:
 line 37: [: verify: unary operator expected

Would you please explain for me?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Another question on awk - Begin statement

Hi, I've a question on awk. In English I want to: (a) open a file, (b) search through the file for records where length of field15 > 20 characters and (c) print out some fields in the record. I've written the following and it works OK. The trouble is this will ALWAYS write out the column... (5 Replies)
Discussion started by: eff_cee
5 Replies

2. Shell Programming and Scripting

IF statement question

Hi there We have boxes named server-sybase2, server-oracle1, etc etc Does any body know how I can construct an if statement to say, if the hostname of the box contains the string "sybase" then do X ie if then X fi any help would be greatly appreciated (6 Replies)
Discussion started by: hcclnoodles
6 Replies

3. Shell Programming and Scripting

If statement - How to write a null statement

In my ksh script, if the conditions of a if statement are true, then do nothing; otherwise, execute some commands. How do I write the "do nothing" statement in the following example? Example: if (( "$x"="1" && "$y"="a" && "$z"="happy" )) then do nothing else command command fi... (3 Replies)
Discussion started by: april
3 Replies

4. Shell Programming and Scripting

compound Bash if then statement question

I am writing a Bash script that will either clone a database or setup a standby database. So Parameter 2 will be the operation type. If the value is not clone or standby I want to throw an error message. I suppose I can also do a case block. So far i have been unable to get the syntax working... (1 Reply)
Discussion started by: gandolf989
1 Replies

5. Shell Programming and Scripting

ksh "case" statement question

Hi I have the following case statement: case $larg in *_* ) a=${larg%_*}; b=${larg#*_}; ;; *^* ) a=${larg%^*}; b=${larg#*^}; ;; esac I cannot figure out what *_* and *^* stand for... Also what a=${larg%_*}; b=${larg#*_}; and a=${larg%^*}; b=${larg#*^}; ... (1 Reply)
Discussion started by: aoussenko
1 Replies

6. Shell Programming and Scripting

perl : semi complex if statement question

Hi there I am trying to write an if statement in perl that will return "SUCCESS" if either of these conditions are true a) if $changes is greater than 5 AND the $force flag is set to 1 OR b) if $changes is greater than 0 AND $changes is less than 6 #!/usr/bin/perl -w my $force =... (5 Replies)
Discussion started by: rethink
5 Replies

7. Shell Programming and Scripting

Quick question regarding if statement

Hi, I'm trying to write an if statement that will check the USER parm against some text but I'm not quite sure how to use the or switch in the statement.. Can anyone help me out?... If someone could also let me know when to use ( or if (( $USER != "user1" || "user2" || "user3" || "user4" ))... (6 Replies)
Discussion started by: Jazmania
6 Replies

8. Programming

question about how the if statement works

on C programming, on an if statement, if u have something like if A && B && C { } if A is false, will it still move on to B and check it? (1 Reply)
Discussion started by: omega666
1 Replies

9. UNIX for Dummies Questions & Answers

Question using 2 variables in a "for" statement

Good Morning, I typically run a batch of commands, from the command line, to process server operating statistics. That would look like this: (these are days of the month) In this instance I am processing a directory of file for July 6th 7th etc. Those files would have names... (9 Replies)
Discussion started by: scotm
9 Replies

10. Shell Programming and Scripting

Convert Update statement into Insert statement in UNIX using awk, sed....

Hi folks, I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex. I have a bunch of update statements with all columns in a file which I need to convert into insert statements. UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies
CGI::Pretty(3pm)					User Contributed Perl Documentation					  CGI::Pretty(3pm)

NAME
CGI::Pretty - module to produce nicely formatted HTML code SYNOPSIS
use CGI::Pretty qw( :html3 ); # Print a table with a single data element print table( TR( td( "foo" ) ) ); DESCRIPTION
CGI::Pretty is a module that derives from CGI. It's sole function is to allow users of CGI to output nicely formatted HTML code. When using the CGI module, the following code: print table( TR( td( "foo" ) ) ); produces the following output: <TABLE><TR><TD>foo</TD></TR></TABLE> If a user were to create a table consisting of many rows and many columns, the resultant HTML code would be quite difficult to read since it has no carriage returns or indentation. CGI::Pretty fixes this problem. What it does is add a carriage return and indentation to the HTML code so that one can easily read it. print table( TR( td( "foo" ) ) ); now produces the following output: <TABLE> <TR> <TD>foo</TD> </TR> </TABLE> Recommendation for when to use CGI::Pretty CGI::Pretty is far slower than using CGI.pm directly. A benchmark showed that it could be about 10 times slower. Adding newlines and spaces may alter the rendered appearance of HTML. Also, the extra newlines and spaces also make the file size larger, making the files take longer to download. With all those considerations, it is recommended that CGI::Pretty be used primarily for debugging. Tags that won't be formatted The following tags are not formatted: <a>, <pre>, <code>, <script>, <textarea>, and <td>. If these tags were formatted, the user would see the extra indentation on the web browser causing the page to look different than what would be expected. If you wish to add more tags to the list of tags that are not to be touched, push them onto the @AS_IS array: push @CGI::Pretty::AS_IS,qw(XMP); Customizing the Indenting If you wish to have your own personal style of indenting, you can change the $INDENT variable: $CGI::Pretty::INDENT = " "; would cause the indents to be two tabs. Similarly, if you wish to have more space between lines, you may change the $LINEBREAK variable: $CGI::Pretty::LINEBREAK = " "; would create two carriage returns between lines. If you decide you want to use the regular CGI indenting, you can easily do the following: $CGI::Pretty::INDENT = $CGI::Pretty::LINEBREAK = ""; AUTHOR
Brian Paulsen <Brian@ThePaulsens.com>, with minor modifications by Lincoln Stein <lstein@cshl.org> for incorporation into the CGI.pm distribution. Copyright 1999, Brian Paulsen. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Bug reports and comments to Brian@ThePaulsens.com. You can also write to lstein@cshl.org, but this code looks pretty hairy to me and I'm not sure I understand it! SEE ALSO
CGI perl v5.14.2 2011-01-24 CGI::Pretty(3pm)
All times are GMT -4. The time now is 01:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy