![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to put "grep" in the if condition.. | mail2sant | Shell Programming and Scripting | 1 | 04-09-2008 02:15 PM |
| Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" | iBot | UNIX and Linux RSS News | 0 | 01-04-2008 12:00 PM |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-19-2007 10:52 PM |
| "sed" to check file size & echo " " to destination file | jockey007 | Shell Programming and Scripting | 6 | 11-13-2007 06:00 PM |
| No utpmx entry: you must exec "login" from lowest level "shell" | peterpan | UNIX for Dummies Questions & Answers | 0 | 01-18-2006 01:15 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I have the below ".sh" file which I just need to put an IF condition to exit from the file/code. Please see the remarks in the code below: Code:
#!/bin/sh
currentdatehour=`date '+%Y-%m-%d-%H'`
hh=`date '+%H'`
currenthour=`expr ${hh} - 0`
onehourback=`expr ${hh} - 1`
twohoursback=`expr ${hh} - 2`
# Just want to put here an IF condition which should be like this:
# if currenthour = 0 then exit (I don't want to implement the below code if "currenthour" equal to "0")
SCRIPT=$PRODUCTROOT/content/ndobss/ndp777mx.sql
OUTFILE=/m/home/salani/r777_hourly_job/r777_${currentdatehour}_from00.txt
. /m/home/salani/dosql.sh
Thanks in advance... |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Try this ....
hh=`date '+%H'`
currenthour=`expr ${hh} - 0` onehourback=`expr ${hh} - 1` twohoursback=`expr ${hh} - 2` echo $currenthour if [ $currenthour -eq 0 ] then echo "it is Zero" exit echo "i will not print .. Exit... " else echo "Non Zero" fi |
|
#3
|
|||
|
|||
|
Thanks... it's working now.
|
|||
| Google The UNIX and Linux Forums |