Sponsored Content
Top Forums Shell Programming and Scripting Echo not displaying variable in If-Else condition Post 302771898 by Chetanz on Friday 22nd of February 2013 04:43:53 AM
Old 02-22-2013
Echo not displaying variable in If-Else condition

Code:
 
if [ "${x_oug}" -ne 0 ]
then
echo "Entry Valid                  :  ${x_oug}"
else
echo "Entry Invalid                  : " 0
fi

In the above code the 3rd line is not working... it does not print anything

I tried following as well .. but no luck!

Code:
echo "Entry Valid                   :   ${x_oug}"
echo "Entry Valid                   :   " ${x_oug}
echo "Entry Valid                   :   $x_oug
echo "Entry Valid                   : " "${x_oug}"

However, if I put a constant like following it works correctly

Code:
echo "Entry valid                  : 5 "

In fact I am forced to use if else as echo not prinitng the variable when it has 0 value

Please help me on this

Thanks and Regards
Chetanz
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Display from a variable using echo.

I have a variable that is outputting a lot of space. here has been 45 lines returned ... how can I remove the spaces between the "been and the 45" CODE: fil_len=`wc -l < coshb.txt` if ; then cat coshb.txt | more echo " " echo "There has been ${fil_len} lines... (4 Replies)
Discussion started by: jagannatha
4 Replies

2. Shell Programming and Scripting

echo variable problem

hi I have say five variable. I would ask the user which one they want me to print and then print accordingly. TEST_1='10.2.3.4' TEST_2='11.2.3.5' TEST_3='12.2.3.5' TEST_4='13.2.3.5' TEST_5='14.2.3.5' print_var() { echo "Accessing var num $1" echo TEST$1 #??? But How do... (6 Replies)
Discussion started by: sabina
6 Replies

3. Shell Programming and Scripting

assigning variable value using echo

I am modifying an existing script and it has the following line: export SomeEnvVar=`echo ${SomeLocalVar}` Why wouldn't it just read: export SomeEnvVar=${SomeLocalVar} Is there some reason to use echo instead of a direct assignment? :confused: (2 Replies)
Discussion started by: shellburger
2 Replies

4. Shell Programming and Scripting

multiple echo statements in if condition

Hi , I have a peculiar problem. i have an if block like this if ; then echo " todays date is " ${date} >> log_file echo " file count is " $ count >> log_file mv filename1 filename 2 else echo "no files available ">> log_file fi the echo statement "no files available " is not... (2 Replies)
Discussion started by: wizardofoz
2 Replies

5. Shell Programming and Scripting

read variable after echo

Hi, i want to create an user-friendly script where you are asked for two numbers. i would like that these two number to be separated with "--" for example, but i can't figure out how to do this. for example read -p "Insert lowest and highest value: " min ; echo -n "-- "; read max so... (3 Replies)
Discussion started by: ezitoc
3 Replies

6. Shell Programming and Scripting

Variable not displaying while running in cron job

hi , While running my script individually the variable is working fine. But when i am running the same script from cron job it's displaying nothing. Can any one comment on this. (4 Replies)
Discussion started by: josephroyal
4 Replies

7. Shell Programming and Scripting

redirect stdout echo command in condition A run in condition B

hi, I have some problems in my simple script about the redirect echo stdout command inside a condition. Why is the echo command inside the elif still execute in the else command Here are my simple script After check on the two diff output the echo stdout redirect is present in two diff... (3 Replies)
Discussion started by: jao_madn
3 Replies

8. Shell Programming and Scripting

echo the NAME of the variable

#!/bin/bash varA="AAA1" varB="BBB2" varC="CCC3" for proccx in $varA $varB $varC do echo "the current name is ????? , the value is $proccx" echo " " done #end of script I want the output to look something like this: the current name is varA, the value is AAA1 the current name is... (5 Replies)
Discussion started by: ajp7701
5 Replies

9. UNIX for Dummies Questions & Answers

Displaying contents with Echo

Hello, How can i display the below ... say echo "Start \n Analyse \n ~/temp/input.txt \nStop" Now my output should look like below Start Analyse This is from input file Stop I tried echo "Start \n Analyse \n $var \nStop where $var = "~/temp/input.txt".. It did not work out..... (3 Replies)
Discussion started by: sathyaonnuix
3 Replies

10. UNIX for Beginners Questions & Answers

Variable not displaying in subject line of mailx email

Hi Newbie here with first post. I've got a shell script (ksh) whereby I run a SQL*Plus script and output the results to a file. I then check the output file in an if statement that looks like this: if ]; then export GAPNUM=`awk '{print $4}' $OUTFILE` if ] then mailx -s... (10 Replies)
Discussion started by: ltzwoman
10 Replies
Biber::Entry::Name(3pm) 				User Contributed Perl Documentation				   Biber::Entry::Name(3pm)

NAME
Biber::Entry::Name - Biber::Entry::Name objects new Initialize a Biber::Entry::Name object, optionally with key=>value arguments. Ex: Biber::Entry::Name->new( lastname=>"Bolzmann", firstname=>"Anna Maria", prefix => "von" ) TO_JSON Serialiser for JSON::XS::encode notnull Test for an empty object was_stripped Return boolean to tell if the passed field had braces stripped from the original set_hash Set a hash for the name get_hash Get a hash for the name set_index Set a field telling what position in the name list the name is get_index Get the index of a Biber::Entry::Name object set_uniquename Set uniquename for a visible Biber::Entry::Name object Sets global flag to say that some uniquename value has changed set_uniquename_all Set uniquename for a Biber::Entry::Name object get_uniquename Get uniquename for a visible Biber::Entry::Name object get_uniquename_all Get uniquename for a Biber::Entry::Name object reset_uniquename Reset uniquename for a Biber::Entry::Name object set_minimal_info Set the string of lastnames and string of fullnames Used to track uniquename=5 or 6 get_minimal_info Get the name context used to track uniquename=5 or 6 get_namepart Get a namepart by passed name set_firstname Set firstname for a Biber::Entry::Name object get_firstname Get firstname for a Biber::Entry::Name object get_firstname_i Get firstname initials for a Biber::Entry::Name object set_middlename Set middlename for a Biber::Entry::Name object get_middlename Get middlename for a Biber::Entry::Name object get_middlename_i Get middlename initials for a Biber::Entry::Name object set_lastname Set lastname for a Biber::Entry::Name object get_lastname Get lastname for a Biber::Entry::Name object get_lastname_i Get lastname initials for a Biber::Entry::Name object set_suffix Set suffix for a Biber::Entry::Name object get_suffix Get suffix for a Biber::Entry::Name object get_suffix_i Get suffix initials for a Biber::Entry::Name object set_prefix Set prefix for a Biber::Entry::Name object get_prefix Get prefix for a Biber::Entry::Name object get_prefix_i Get prefix initials for a Biber::Entry::Name object set_gender Set gender for a Biber::Entry::Name object get_gender Get gender for a Biber::Entry::Name object set_namestring Set namestring for a Biber::Entry::Name object get_namestring Get namestring for a Biber::Entry::Name object set_nameinitstring Set nameinitstring for a Biber::Entry::Name object get_nameinitstring Get nameinitstring for a Biber::Entry::Name object name_to_bbl { Return bbl data for a name name_to_bltxml { Add BibLaTeXML for the name to an XML::Writer object dump Dump Biber::Entry::Name object AUTHORS
Francois Charette, "<firmicus at ankabut.net>" Philip Kime "<philip at kime.org.uk>" BUGS
Please report any bugs or feature requests on our sourceforge tracker at <https://sourceforge.net/tracker2/?func=browse&group_id=228270>. COPYRIGHT &; LICENSE Copyright 2009-2012 Francois Charette and Philip Kime, all rights reserved. This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. perl v5.14.2 2012-06-17 Biber::Entry::Name(3pm)
All times are GMT -4. The time now is 11:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy