Sponsored Content
Full Discussion: Check for empty string
Top Forums Shell Programming and Scripting Check for empty string Post 302161181 by rahman_riyaz on Wednesday 23rd of January 2008 11:25:43 PM
Old 01-24-2008
Bug Check for empty string

Hello All,

I have written shell script whcih at the max 3 parameters.

When only one commandline argument and other two command line arguments are passed as empty string like

eg : archive ' ' ' '

Then i need to check whether the commandline arguments are empty or not.

i have use -n and ! -z but both of them fail for the above scenario.

Please let me know what is the alternative to solve this problem.

Thanks in anticipation
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to check for null or empty string

Hi, I need to check for value not equal (<>) to 21 and not equal empty or null values. Please modify this script if then echo "$VALUE,$BSC_NAME,$BSC_ID" > $OUT_FILE/power_up.out end if TQ (5 Replies)
Discussion started by: doer
5 Replies

2. UNIX for Dummies Questions & Answers

How to check if a file is empty?

Hi Masters..... I have problem !!! I need to check number of records in a file and if it is zero or file is empty i need to do some task. if ; then echo "File s empty" else echo "Not empty" fi so how to check this condition. I used wc -l < filename.txt => 1 for zero records same result... (1 Reply)
Discussion started by: shreekrishnagd
1 Replies

3. Shell Programming and Scripting

check whether the directory is empty or not

I have the list of users in user.log, under each user folder there is sub1 folder is there. i want to check whether sub1 is empty or not, if it is empty i have to skip that user user folder and iterate next user folders. i have the sample code,its not giving not proper results. while read line... (8 Replies)
Discussion started by: KiranKumarKarre
8 Replies

4. Shell Programming and Scripting

check empty directory !!!

I need to check if a directory is empty using an if condition in the pseudocode below if ; then else although i looked at a few forums on this topic, I left feeling a little unclear and i could not use the command successfully what can i substitute in the if conditon above,... (2 Replies)
Discussion started by: allah_waris45
2 Replies

5. UNIX for Dummies Questions & Answers

Check to see if string var is empty

i have a veriable set var1 set var2 = abcd how can i check if var 1 is empty and if var 2 is not empty ??? (2 Replies)
Discussion started by: nirnir26
2 Replies

6. Shell Programming and Scripting

Check if the string is empty

I am reading from a file and executing the jobs with/without parameters as the job requires. File job1 R job2 job3 Y 123 if then <job>.ksh else <job>.ksh $params fi This works fine if the line read from the file has parameters it executes like job1.ksh R But for... (2 Replies)
Discussion started by: nw2unx123
2 Replies

7. Shell Programming and Scripting

How to check whether a variable is empty or contains some value?

hi, i want to check whether a a variable contains some value or is empty in a shell script. so if the variable contains some value i want to do some job and if the variable doesnt contain any value then i need to skip that job. here is a sample script read_filenames.sh contains ... (5 Replies)
Discussion started by: Little
5 Replies

8. Shell Programming and Scripting

Empty file check

Hi gurus , I have two files and i want to perform different action based on the condition if both or either is empty If then Do something elif then do something elif then do something else do something fi I have tried the below bt its not... (4 Replies)
Discussion started by: r_t_1601
4 Replies

9. Shell Programming and Scripting

How to check empty string in an XML tag?

I have an XML tag <abc> which is empty as <abc></abc>.If the the tag is empty I want to flag the file as bad. Please help. Thanks (3 Replies)
Discussion started by: aneeta13
3 Replies

10. Shell Programming and Scripting

Cant check empty string

Hello So i have that script collection, in which i have a single script to create a configuration file. In there, i have multiple occourences of something like this: prj_title=$(tui-read "What is the TITLE? ($prj_name):") ] && prj_title="${prj_name/_/ }" They all work as expected, if... (5 Replies)
Discussion started by: sea
5 Replies
WATCHDOG.CONF(5)						File Formats Manual						  WATCHDOG.CONF(5)

NAME
watchdog.conf - configuration file for the watchdog daemon DESCRIPTION
This file carries all configuration options for the Linux watchdog daemon. Each option has to be written on a line for itself. Comments start with '#'. Blanks are ignored except after the '=' sign. An empty text after the '=' sign disables the feature as long as that makes sense. OPTIONS
interval = <interval> Set the interval between two writes to the watchdog device. The kernel drivers expects a write command every minute. Otherwise the system will be rebooted. Default value is 1 second. An interval of more than a minute can only be used with the -f command-line option. logtick = <logtick> If you enable verbose logging, a message is written into the syslog or a logfile. While this is nice, it is not necessary to get a message every 10 seconds which really fills up disk and needs CPU. logtick allows adjustment of the number of intervals skipped before a log message is written. If you use logtick = 60 and interval = 10, only every 10 minutes (600 seconds) a message is writ- ten. This may make the exact time of a crash harder to find but greatly reduces disk usage and administrator nerves if you're look- ing for a particular syslog entry in between of watchdog messages. max-load-1 = <load1> Set the maximal allowed load average for a 1 minute span. Once this load average is reached the system is rebooted. Default value is 0. That means the load average check is disabled. Be careful not to this parameter too low. To set a value less then the predefined minimal value of 2, you have to use the -f commandline option. max-load-5 = <load5> Set the maximal allowed load average for a 5 minute span. Once this load average is reached the system is rebooted. Default value is 3/4*max-load-1. Be careful not to this parameter too low. To set a value less then the predefined minimal value of 2, you have to use the -f commandline option. max-load-15 = <load15> Set the maximal allowed load average for a 15 minute span. Once this load average is reached the system is rebooted. Default value is 1/2*max-load-1. Be careful not to this parameter too low. To set a value less then the predefined minimal value of 2, you have to use the -f commandline option. min-memory = <minpage> Set the minimal amount of virtual memory that has to stay free. Note that this is in pages. Default value is 0 pages which means this test is disabled. The page size is taken from the system include files. max-temperature = <temp> Set the maximal allowed temperature. Once this temperature is reached the system is halted. Default value is 120. There is no unit conversion, so make sure you use the same unit as your hardware. Watchdog will issue warnings once the temperature increases 90%, 95% and 98% of this temperature. watchdog-device = <device> Set the watchdog device name. Default is to disable keep alive support. watchdog-timeout = <timeout> Set the watchdog device timeout during startup. If not set, the default is driver-dependent. temperature-device = <temp-dev> Set the temperature device name. Default is to disable temperature checking. file = <filename> Set file name for file mode. This option can be given as often as you like to check several files. change = <mtime> Set the change interval time for file mode. This options always belongs to the active filename, that is when finding a 'change =' line watchdog assumes it belongs to the most recently read 'file =' line. They don't neccessarily have to follow each other directly. But you cannot specify a 'change =' before a 'file ='. The default is to only stat the file and don't look for changes. Using this feature to monitor changes in /var/log/messages might require some special syslog daemon configuration, e.g. rsyslog needs "$ActionWriteAllMarkMessages on" to be set to make sure the marks are written no matter what. pidfile = <pidfilename> Set pidfile name for server test mode. This option can be given as often as you like to check several servers. ping = <ip-addr> Set IP address for ping mode. This option can be used more than once to check different connections. interface = <if-name> Set interface name for network mode. This option can be used more than once to check different interfaces. test-binary = <testbin> Execute the given binary to do some user defined tests. test-timeout = <timeout in seconds> User defined tests may only run for <timeout> seconds. Set to 0 for unlimited. repair-binary = <repbin> Execute the given binary in case of a problem instead of shutting down the system. repair-timeout = <timeout in seconds> repair command may only run for <timeout> seconds. Set to 0 for unlimited. admin = <mail-address> Email address to send admin mail to. That is, who shall be notified that the machine is being halted or rebooted. Default is 'root'. If you want to disable notification via email just set admin to en empty string. realtime = <yes|no> If set to yes watchdog will lock itself into memory so it is never swapped out. priority = <schedule priority> Set the schedule priority for realtime mode. test-directory = <test directory> Set the directory to run user test/repair scripts. Default is '/etc/watchdog.d' See the Test Directory section in watchdog(8) for more information. log-dir = <log directory> Set the log directory to capture the standard output and standard error from repair-binary and test-binary execution. Default is '/var/log/watchdog'. FILES
/etc/watchdog.conf The watchdog configuration file /etc/watchdog.d A directory containing test-or-repair commands. See the Test Directory section in watchdog(8) for more information. SEE ALSO
watchdog(8) 4th Berkeley Distribution January 2005 WATCHDOG.CONF(5)
All times are GMT -4. The time now is 09:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy