Sponsored Content
Top Forums Shell Programming and Scripting Check parameter is number or string Post 302529945 by Eclecticaa on Saturday 11th of June 2011 02:07:19 PM
Old 06-11-2011
Check parameter is number or string

Hey I'm new in linux,

I'm looking for a code to check whether the parameter is a number or a string.

I have already tried this code:
Code:
eerste=$(echo $1 | grep "^[0-9]*$">aux)
if [ eerste ]

But it doesn't work.Smilie
Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to check parameter variable?

Hello All, I have a script that will email out if the email address is specified as parameter 1. I am using ksh, and then tried the following : email=$1 Following did not work, I am getting error test -z $email test ${email:=" ") -eq " " test -n $email test ${?email} What... (4 Replies)
Discussion started by: negixx
4 Replies

2. Shell Programming and Scripting

Help with making a parameter check script.

I am making a script to check the parameters, but it seems that I can't catch the parameters by loop. $ cat sendmsg.sh #!/bin/sh ## Parameter Check i=0 max=$# while do PARAM=$${i} i=`expr ${i} + 1` echo ${PARAM} done How can I get the $1, $2, $3 by loop and set their... (2 Replies)
Discussion started by: GCTEII
2 Replies

3. UNIX for Dummies Questions & Answers

check whether variable number or string

I am passing an argument to a file and i wanna check whether the argument is a number or string ? how can i do this? (4 Replies)
Discussion started by: rolex.mp
4 Replies

4. Shell Programming and Scripting

how to search string and number in one file and check in the other file

Hi, Can anyone help in the below problem. file1 has the below contents fileset 999 primary-ilist inode 37020 has invalid dotdot (426094) -> Not exist fileset 999 primary-ilist inode 115016 dup block ->... (9 Replies)
Discussion started by: knshree
9 Replies

5. Shell Programming and Scripting

Check if parameter passes in contains certain string

Hi Guys, I am writing a Unix script which accepts a directory path as parameter $1 so something like /user5.data/WA/01 will be passed in. I want to determine if the directory path passed in contains "WA" as above (because then I need to do something specific if it does) What is the... (9 Replies)
Discussion started by: bcunney
9 Replies

6. Shell Programming and Scripting

How to check whether a string is number or not

Hi , I am facing a problem .. which looks simple... but took 2 days of mine.. even now it is not solved completely.. I have one variable..., want to know whether that variable contains number... canbe +ve or -ve ... Values +35 --- number -43 --- number 45A -- non number... (12 Replies)
Discussion started by: shihabvk
12 Replies

7. Shell Programming and Scripting

How to Check given string is number in shell script?

Hi, Can anyone help me out to check whether the input argument is number? Example: REQUEST_ID="123456" I need to check the REQUEST_ID value is number or string. Thanks in Advance Regards BS (6 Replies)
Discussion started by: balajiora
6 Replies

8. Shell Programming and Scripting

Dynamic number of parameter

Hi all Is there away to create a script with dynamic number of parameter.. like the kill command in UNIX kill -9 xxx xxx cheers (4 Replies)
Discussion started by: co0oly
4 Replies

9. Shell Programming and Scripting

Check input parameter

Hi all i need to check that if user has passed any input parameter while executing he shell script like ./test1.sh -a"-v" then do smothing if user execute the script without giving input paramater then ./test1.sh then do something how can we check this input parameter (6 Replies)
Discussion started by: aishsimplesweet
6 Replies

10. AIX

Maxuproc parameter and number of processes

Hi there, I am having a problem on an AIX server running a WebSphere MQ instance. The problem is that sometimes it seems to reach process limit, but I do not find the processes themselves. What I see: succeed to log in (as root from console os as nonpriviliged user via ssh). Trying to run... (19 Replies)
Discussion started by: trifo75
19 Replies
OCF_HEARTBEAT_SQUID(7)						OCF resource agents					    OCF_HEARTBEAT_SQUID(7)

NAME
ocf_heartbeat_Squid - Manages a Squid proxy server instance SYNOPSIS
Squid [start | stop | status | monitor | meta-data | validate-all] DESCRIPTION
The resource agent of Squid. This manages a Squid instance as an HA resource. SUPPORTED PARAMETERS
squid_exe This is a required parameter. This parameter specifies squid's executable file. (required, string, no default) squid_conf This is a required parameter. This parameter specifies a configuration file for a squid instance managed by this RA. (unique, required, string, no default) squid_pidfile This is a required parameter. This parameter specifies a process id file for a squid instance managed by this RA. (unique, required, string, no default) squid_port This is a required parameter. This parameter specifies a port number for a squid instance managed by this RA. If plural ports are used, you must specifiy the only one of them. (unique, required, integer, no default) squid_stop_timeout This is an omittable parameter. On a stop action, a normal stop method is firstly used. and then the confirmation of its completion is awaited for the specified seconds by this parameter. The default value is 10. (optional, integer, default 10) debug_mode This is an optional parameter. This RA runs in debug mode when this parameter includes 'x' or 'v'. If 'x' is included, both of STDOUT and STDERR redirect to the logfile specified by "debug_log", and then the builtin shell option 'x' is turned on. It is similar about 'v'. (optional, string, no default) debug_log This is an optional and omittable parameter. This parameter specifies a destination file for debug logs and works only if this RA run in debug mode. Refer to "debug_mode" about debug mode. If no value is given but it's requied, it's made by the following rules: "/var/log/" as a directory part, the basename of the configuration file given by "syslog_ng_conf" as a basename part, ".log" as a suffix. (optional, string, no default) SUPPORTED ACTIONS
This resource agent supports the following actions (operations): start Starts the resource. Suggested minimum timeout: 60s. stop Stops the resource. Suggested minimum timeout: 120s. status Performs a status check. Suggested minimum timeout: 60. monitor Performs a detailed status check. Suggested minimum timeout: 30s. Suggested interval: 10s. meta-data Retrieves resource agent metadata (internal use only). Suggested minimum timeout: 5s. validate-all Performs a validation of the resource configuration. Suggested minimum timeout: 5. EXAMPLE
The following is an example configuration for a Squid resource using the crm(8) shell: primitive p_Squid ocf:heartbeat:Squid params squid_exe=string squid_conf=string squid_pidfile=string squid_port=integer op monitor depth="0" timeout="30s" interval="10s" SEE ALSO
http://www.linux-ha.org/wiki/Squid_(resource_agent) AUTHOR
Linux-HA contributors (see the resource agent source for information about individual authors) resource-agents UNKNOWN 03/09/2014 OCF_HEARTBEAT_SQUID(7)
All times are GMT -4. The time now is 09:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy