Sponsored Content
Top Forums Shell Programming and Scripting Help needed on wrapper script Post 302901058 by MadeInGermany on Sunday 11th of May 2014 11:17:22 AM
Old 05-11-2014
Once you have the format assured, you can verify the date with the cal command.
Code:
            echo "enter the loadings date in YYYYMMDD format: "
            read dt
       
            # validates the date format
            echo "$dt" | grep -E -q '^201[1-9](0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])$'
            if [[ $? -ne 0 ]]; then
                   echo "========================================================================="
                   echo "Please enter the date in YYYYMMDD format. Terminating...No action done..."
                   exit
            else
                   year=${dt%????}
                   md=${dt#????}
                   month=${md%??}
                   day=${md#??}
                   cal $month $year | grep -q -w $((day))
                   if [[ $? -ne 0 ]]; then
                        echo "This date does not exist. Terminating...No action done." 
                        exit
                   else
                        .${HOME}/dbscripts/set_date.ksh $dt &
                        .${HOME}/dbscripts/data_load.ksh $file & 
                   fi
            fi

NB I have removed the double [ from the ERE that would allow a [ character in the input.
This User Gave Thanks to MadeInGermany For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

What is wrapper script and how to write

hi guys, I have a requirement to run a script 4 times with different parameter values. the 4 jobs have to run parallely which actually access different data of same table and deletes. how can i achieve this.................? Thanks in advance (1 Reply)
Discussion started by: chiru
1 Replies

2. UNIX for Dummies Questions & Answers

What is a wrapper script

I tried searching the forum ,,but couldn't locate ..Can anyone give me a link or some information about wrapper script. (1 Reply)
Discussion started by: thana
1 Replies

3. Shell Programming and Scripting

Korn Shell Wrapper script

Hi Guys, I am trying write a wrapper script but I don't have any idea. I have 4 different korn shell scripts and all of them needs some parameters from command line (positional parameter). My script cant be interactive because its supposed to be automated. I am confused how can I write a wrapper... (6 Replies)
Discussion started by: pareshan
6 Replies

4. Shell Programming and Scripting

Help with a wrapper script not working

Hello, I have the below wrapper script: #!/usr/bin/perl -w if ($^O eq 'MSWin32' ) { $subnet = 'c:\path\to\subnet.txt'; } else { $subnet = '/opt/qip/wrapper-del-sub'; } open FH1, 'jj-deleted-subnets.txt' or die "Can't open 'jj-deleted-subnets.txt' ... (0 Replies)
Discussion started by: richsark
0 Replies

5. Shell Programming and Scripting

wrapper script in perl

Hi, I am in need of way to facilitate this senerio in a perl script. I have CLI ( command line interface) which I run like so: kip-tepltist -u Xxx -p Xxx Which produces tones of names from each template it found: 194Iselin-NJ 33-IDFLB-North-611-Woodward-8600 ... (5 Replies)
Discussion started by: richsark
5 Replies

6. Shell Programming and Scripting

Count script wrapper help

I have this a code that I got help with for another task. I since tried to modify it to work on this task. I need someones expertise to modify it slightly and I am not sure where to start or yet fully understand the logic. I am trying to get a script to read my m-names.txt which has lots... (19 Replies)
Discussion started by: richsark
19 Replies

7. UNIX for Advanced & Expert Users

Pass parameter to the main script from wrapper script

Hi, I am writing a wrapper script(wrap_script.sh) to one of the main scripts (main_script.sh) The main script is executed as following: ./main_script.sh <LIST> <STARTDATE> <ENDDATE> looks for a parameter which is a LIST(consists of different list names that need to be processed), START/END... (0 Replies)
Discussion started by: stunnerz_84
0 Replies

8. Shell Programming and Scripting

Wrapper Script in Perl Or shell

Hello, My requirement is based on Oracle where we run a perl script and it asked some questions.I want to write a wrapper which will answer all these questions. How is it possible. Thanks (16 Replies)
Discussion started by: cotton
16 Replies

9. Shell Programming and Scripting

problem with the my wrapper script

Hi friends, i am working in ksh88. i am running the follwing wapper script in background to run two jobs parallely((eg nohup wrapper.ksh &):: wrapper.ksh ######################## #!/bin/ksh nohup ./pii_insert.ksh /nsing83/p2/test & nohup ./pii_update.ksh... (1 Reply)
Discussion started by: neelmani
1 Replies

10. Programming

Wrapper for unix program - urgent help needed

Hello all , i need some help asap i have a program that keeps killing the machine when i did google searches and 2 days later i ran strace it seems the programm keeps making a system call to gettimeofday to i guess increment a counter ? gettimeofday({1347986584, 464904}, NULL) = 0... (6 Replies)
Discussion started by: NetworkLearning
6 Replies
ikisite-wrapper(1)					      General Commands Manual						ikisite-wrapper(1)

NAME
ikisite-wrapper - suid wrapper for ikisite SYNOPSIS
ikisite-wrapper subcommand options DESCRIPTION
ikisite-wrapper is a wrapper around ikisite. It is designed to be safely made suid root, though it is not currently suid by default. A few ikisite subcommands can be run using the wrapper without any authorisation at all. These include: create, branch, list, sitelookup, checklock, updatecustomersite, and enabledns. So making the wrapper suid allows any user to create a site. Other ikisite subcommands can only be run using the wrapper by users who specify a nonce in the IKISITE_NONCE environment variable. These include: delete, changesetup, domains, and deletenonce. A site's current nonces are stored in its .ikisite-nonce file. A nonce can be generated by root or the site's user via using the creat- enonce subcommand, but it's usually generated by passing --createnonce to the create or branch subcommands. This allows anyone to create or branch a site and then use the nonce to allow further configuration of it (and delete it if something goes wrong). Subcommands that can be called by the wrapper either without or with a nonce should be sure to fully validate their inputs. SEE ALSO
ikisite(1) AUTHOR
Joey Hess <joey@ikiwiki.info> ikisite-wrapper(1)
All times are GMT -4. The time now is 12:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy