09-26-2007
If condition not working
Hi Gurus,
I have shell script in which i have to check if time is between to possible value or not. For that i am using following line of code
if [ "$ftime" -gt 01:00 && "$ftime" -lt 05:00 ]
then
echo 'Found In Between'
echo $ftime
fi
but when i am executing the script i am getting
test: ] missing
error.
Please help me to resolve this.
Thanks in Advance
Manish
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am using RHEL5.
I have following if condition.
if
In the above condition, if the value of a contains word WARNING, it should match. i.e., WARNING_MESSAGE, CRITICAL WARNING, WARNING ALERT etc. it should match.
For b, alert error, ALERT ERROR, ERROR IMMEDIATE ACTION REQUIRED, etc... (2 Replies)
Discussion started by: user7509
2 Replies
2. UNIX for Advanced & Expert Users
checkSync()
{
CONNECT_STRING=TLDB61/TLDB61@TL10G
SQLPLUS_SETTINGS="SET PAGESIZE 0 LINESIZE 1500 ECHO OFF TRIMS ON TAB OFF FEEDBACK OFF HEADING OFF"
SQL_RESULT_SYNC_PMCM=`sqlplus -s ${CONNECT_STRING} << EOF
${SQLPLUS_SETTINGS}
(SELECT... (2 Replies)
Discussion started by: madfox
2 Replies
3. Shell Programming and Scripting
Hi all,
ssh uname@remote_server 'cat /tmp/remote_file_name > home_dir/a512386/new/local_file_name'
The above given command is working fine.
but if i try to move the file only if exists in the remote server i.e) giving the same within if condition it executes but the file is not stored in my... (1 Reply)
Discussion started by: Shri123
1 Replies
4. HP-UX
Executed the following if conditions .. and got different results .
only (( )) gave correct o/p with all scenarios .
Can anybody please let me know what is the difference between and ] and ((condition)) when used with if condition.
And why each condition gave different result.
1.... (2 Replies)
Discussion started by: soumyabubun
2 Replies
5. Shell Programming and Scripting
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
6. Shell Programming and Scripting
HI
My doubt may be basic one but I need to get it clarified..
When i use "if" condition that checks for many AND, OR logical conditions
like
if ]; then
return 0
fi
Even the if condition fails it returns as zero.. Any clue..
But if i add else condition like
if ]; ... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies
7. Shell Programming and Scripting
I am trying to automate a script where I need to use pbrun /bin/su but for some reason it is not passing thru the pbrun as my code below.
. ~/.bash_profile
pbrun /bin/su - content
c h 1
hpsvn up file path
I am executing this from an external .sh file that is pointing to this scripts file... (14 Replies)
Discussion started by: jorgejac
14 Replies
8. UNIX for Beginners Questions & Answers
Hi Team,
If condition is not working properly and getting below error
# ./score1.sh
Enter your score ('q' for quit): 102
Enter your score ('q' for quit): q
./score1.sh: line 9: q: integer expression expected
Average is: 102%.
Exit.
Actual code
# Calculate the average of given... (3 Replies)
Discussion started by: Torrid
3 Replies
9. Shell Programming and Scripting
Hi Team,
I have written the shell script which returns the result of the disk space filesystems which has crossed the threshold limit in HTML Format. Below mentioned is the script which worked perfectly on QA system.
df -h | awk -v host=`hostname` '
BEGIN {
print "<table border="4"... (13 Replies)
Discussion started by: Harihsun
13 Replies
10. Shell Programming and Scripting
I have a requirement to perform specific set of tasks based on server , So I want to have the condition(s) defined based on server. Here is the script I came up with and I have read multiple blogs and couldn`t find any mistake from my script. Can you guide on what I am overlooking here ?
... (2 Replies)
Discussion started by: Varja
2 Replies
LEARN ABOUT DEBIAN
explain_ftime_or_die
explain_ftime_or_die(3) Library Functions Manual explain_ftime_or_die(3)
NAME
explain_ftime_or_die - return date and time and report errors
SYNOPSIS
#include <libexplain/ftime.h>
void explain_ftime_or_die(struct timeb *tp);
int explain_ftime_on_error(struct timeb *tp);
DESCRIPTION
The explain_ftime_or_die function is used to call the ftime(3) system call. On failure an explanation will be printed to stderr, obtained
from the explain_ftime(3) function, and then the process terminates by calling exit(EXIT_FAILURE).
The explain_ftime_on_error function is used to call the ftime(3) system call. On failure an explanation will be printed to stderr, obtained
from the explain_ftime(3) function, but still returns to the caller.
tp The tp, exactly as to be passed to the ftime(3) system call.
RETURN VALUE
The explain_ftime_or_die function only returns on success, see ftime(3) for more information. On failure, prints an explanation and exits,
it does not return.
The explain_ftime_on_error function always returns the value return by the wrapped ftime(3) system call.
EXAMPLE
The explain_ftime_or_die function is intended to be used in a fashion similar to the following example:
explain_ftime_or_die(tp);
SEE ALSO
ftime(3)
return date and time
explain_ftime(3)
explain ftime(3) errors
exit(2) terminate the calling process
COPYRIGHT
libexplain version 0.52
Copyright (C) 2009 Peter Miller
explain_ftime_or_die(3)