Sponsored Content
Top Forums UNIX for Dummies Questions & Answers echo statement when find returns null Post 302355008 by varontron on Monday 21st of September 2009 08:04:34 AM
Old 09-21-2009
you can redirect the 'find...-print' output to a file

Code:
find ... -print > file.out

and then call word count (lines only) into a variable.

Code:
COUNT=`wc -l file.out`

then eval $COUNT and output your error when = 0, or the contents of file.out when >0.

hth,
dv
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

echo statement

Does anyone know the correct syntax for computing arithmetic expressions inside the echo statement? Let me know, thanks (3 Replies)
Discussion started by: circleW
3 Replies

2. Shell Programming and Scripting

If statement falling over on a null record. Help please.

Okay i've got some code which reads a text file and loops through it and there a few if statements inside where one is failing (the one bolded). Basically the acc column contains a list of three digit access codes, some though have null records (i.e nothing in the field) so what I want to do is... (3 Replies)
Discussion started by: TonyR
3 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. IP Networking

gethostbyname_r returns NULL when hostname has dash

We have a code to find the DNS entry of a host that has a trailing '-' in its url (format example: mysite-.watch.com): if(gethostbyname_r(host,host_ent,host_buffer,host_buffer_size,&host_error)==NULL) { //failed } But when remove the '-' from the host name the code does not return... (12 Replies)
Discussion started by: uunniixx
12 Replies

5. Programming

PEM_read_RSAPublicKey returns NULL

Hi all, I am trying to write a program in C which will generate private and public keys using openssl RSA and use these for encryption and decryption. I am able to generate the keys successfully and write these to files. I am able to read the private key successfully. I can encrypt and decrypt... (1 Reply)
Discussion started by: Treasa
1 Replies

6. Shell Programming and Scripting

awk returns null?

hi i try to check if awk returns null and i dont know how it's works this is the command set EndByC = `ls -l $base | awk '/.c$/ {print $9}'` if ($EndByC=="") then #check if ther is XXX.c directory echo Sorry ther is no XXX.c folder "in" $base path echo the XXX.c folder is necessary... (6 Replies)
Discussion started by: frenkelor
6 Replies

7. Shell Programming and Scripting

echo x - returns: x: command not found

I have been experiencing this problem intermittantly, I thought the problem was '/bin/sh -> /bin/dash' but I changed that to bash and the problem persists. I am writing functions to be included in user's '.bash_profile' through source or '.' filename a quick example of the problem is illustrated... (3 Replies)
Discussion started by: bsquared
3 Replies

8. Shell Programming and Scripting

If statement for null

Hi, I want to be able to check if a variable is not equal to null. I am using KSH, and am getting this error message when i run this script: : assignment requires lvalue The line which is causing the problem is as follows: if (($SFTP_DESTINATION != '' ));then if ssh... (6 Replies)
Discussion started by: Jack_Maloney
6 Replies

9. HP-UX

Ping echo not returns

Hi there, I have 2 HP-UX on same subnet and having a problem on one about ping. I'll call them as hp01 hp02. hp01 can ping hp02 (ping says %100 transmitted) hp01 can ssh/telnet hp02 hp02 can ssh/telnet hp01 hp02 cannot ping hp02 (ping says %100 packet loss) There I thought of ndd... (4 Replies)
Discussion started by: royalliege
4 Replies

10. UNIX for Advanced & Expert Users

echo 2>/dev/null with a find command help

Why does this not work? echo 'find / -iname \'*katt*\' -size +500M 2>/dev/null' How does this work? I have 5 single quotes. I though you needed an even amount of single quotes. echo 'find / -iname \'*katt*\' -size +500M 2>/dev/null'' What is the trick to make it work with an alias? This... (4 Replies)
Discussion started by: cokedude
4 Replies
PPIx::EditorTools::IntroduceTemporaryVariable(3pm)	User Contributed Perl Documentation	PPIx::EditorTools::IntroduceTemporaryVariable(3pm)

NAME
PPIx::EditorTools::IntroduceTemporaryVariable - Introduces a temporary variable using PPI SYNOPSIS
my $munged = PPIx::EditorTools::IntroduceTemporaryVariable->new->introduce( code => "use strict; BEGIN { $^W = 1; } my $x = ( 1 + 10 / 12 ) * 2; my $y = ( 3 + 10 / 12 ) * 2; ", start_location => [ 2, 19 ], end_location => [ 2, 25 ], varname => '$foo', ); my $modified_code_as_string = $munged->code; my $location_of_new_var_declaration = $munged->element->location; DESCRIPTION
Given a region of code within a statement, replaces all occurrences of that code with a temporary variable. Declares and initializes the temporary variable right above the statement that included the selected expression. METHODS
new() Constructor. Generally shouldn't be called with any arguments. find( ppi => PPI::Document, start_location => Int, end_location => Int, varname => Str ) =item find( code => Str, start_location => Int, end_location => Int, varname => Str ) Accepts either a "PPI::Document" to process or a string containing the code (which will be converted into a "PPI::Document") to process. Given the region of code specified by start_location and end_location, replaces that code with a temporary variable with the name given in varname (defaults to "tmp"). Declares and initializes the temporary variable right above the statement that included the selected expression. Returns a "PPIx::EditorTools::ReturnObject" with the modified code as a string available via the "code" accessor (or as a "PPI::Document" via the "ppi" accessor), and the "PPI::Token" where the new variable is declared available via the "element" accessor. Croaks with a "no token" exception if no token is found at the location. Croaks with a "no statement" exception if unable to find the statement. SEE ALSO
This class inherits from "PPIx::EditorTools". Also see App::EditorTools, Padre, and PPI. perl v5.14.2 2012-03-11 PPIx::EditorTools::IntroduceTemporaryVariable(3pm)
All times are GMT -4. The time now is 06:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy