Sponsored Content
Top Forums Shell Programming and Scripting check input = "empty" and "numeric" Post 302150872 by rikxik on Thursday 13th of December 2007 12:54:15 AM
Old 12-13-2007
The case statement itself can manage full numeric check (for both integers and floating point numbers):

Quote:
#!/usr/bin/ksh

VAR=$1

if test "$VAR" = ""
then
echo empty
fi

case $VAR in
+([0-9])*(.)*([0-9]) )
echo it definitely is numeric
;;
* )
;;
esac
HTH
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Solaris

How to check "faulty" or "stalled" print queues - SAP systems?

Hi all, First off, sorry for a long post but I think I have no other option if I need to explain properly what I need help for. I need some advise on how best to check for "faulty" or "stalled/jammed' print queues. At the moment, I have three (3) application servers which also acts as print... (0 Replies)
Discussion started by: newbie_01
0 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. Solaris

The slices "usr", "opt", "tmp" disappeared!!! Help please.

The system don't boot. on the screen appears following: press enter to maintenance (or type CTRL-D to continue)...I checked with format command. ... the slices "0-root","1-swap","2-backup" exist. ...the slises "3-var","6-usr" -unassigned. :( (16 Replies)
Discussion started by: wolfgang
16 Replies

5. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

6. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

7. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies
Excel::Template::Container::Conditional(3pm)		User Contributed Perl Documentation	      Excel::Template::Container::Conditional(3pm)

NAME
Excel::Template::Container::Conditional - Excel::Template::Container::Conditional PURPOSE
To provide conditional execution of children nodes NODE NAME
IF INHERITANCE
CONTAINER ATTRIBUTES
o NAME This is the name of the parameter to test. It is resolved like any other parameter name. (q.v. VAR for more info.) o VALUE If VALUE is set, then a comparison operation is done. The value of NAME is compared to VALUE using the value of OP. o OP If VALUE is set, then this is checked. If it isn't present, then '==' (numeric equality) is assumed. OP must be one of Perl the numeric comparison operators or the string comparison operators. All 6 of each kind is supported. Note: If you want to use < or <=, you must instead use &lt; or &lt;=. This is to make sure it will parse with XML::Parser. You should not need to use &gt; or &gt;= instead of > and >=, respectively. o IS If VALUE is not set, then IS is checked. IS is allowed to be either "TRUE" or "FALSE". The boolean value of NAME is checked against IS. CHILDREN
None EFFECTS
None DEPENDENCIES
None USAGE
<if name="__ODD__" is="false"> ... Children here </if> In the above example, the children will be executed if the value of __ODD__ (which is set by the LOOP node) is false. So, for all even iterations. AUTHOR
Rob Kinyon (rob.kinyon@gmail.com) SEE ALSO
LOOP, VAR perl v5.14.2 2010-06-17 Excel::Template::Container::Conditional(3pm)
All times are GMT -4. The time now is 10:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy