Sponsored Content
Top Forums Shell Programming and Scripting Shell function parsing arguments, which didn't receive. Why? Post 303006133 by digioleg54 on Friday 27th of October 2017 11:12:24 AM
Old 10-27-2017
Shell function parsing arguments, which didn't receive. Why?

I have a shell script, which has a function, which call a perl script. Also it has a shell function call parse_ars as fogllow:
Code:
#!/bin/ksh

load_ici_dat() {
cd ${OUTPUT_DIR}
typeset batch_file=XRED${MM}${DD}
typeset SCRIPT="${PROG}.pl"
echo "time ${PERLEXE5X} ${PERL_HOME}/${SCRIPT} ${ORACLE_USER} ${PROCESS_DATE}"
time ${PERLEXE5X} ${PERL_HOME}/${SCRIPT} ${ORACLE_USER} ${PROCESS_DATE}
if [ $? -ne 0 ]
then
abnormal_termination "${STEP}" "${OUTPUT_DIR}" "Fail to run ${PERL_HOME}/${S
CRIPT}"
fi
}

################################################################################
###############################
# Main Program
################################################################################
###############################
PROG=`basename $0 | awk -F. '{print($1)}'`

parse_args $@
_PROCESS_DATE_PRESET_="${PROCESS_DATE}"

In pARSE_ARGS I HAVE:

Code:
echo "VARVAR $#"
if [ $# -gt 0 ]
then
export THREAD_ARG="$@"
while [ ! -z "$1" ]
do
case $1 in
-P* | -p* )
export PROCESS_DATE=$2
export MM=`echo $2 | cut -c5-6`
export DD=`echo $2 | cut -c7-8`
export YY=`echo $2 | cut -c3-4`
export YYYY=`echo $2 | cut -c1-4`
export PROCESS_DATE_US_MMDDYY="$MM/$DD/$YY"
shift
;;
-OUT* | -OUt* | -Out* | -out* | -oUT* | -ouT* | -oUt* )
if [ -d $2 ]
then
export OUTPUT_DIR=$2
fi
shift
;;
-IN* | -In* | -in* | -iN* )
if [ -d $2 ]
then
export INPUT_DIR=$2
fi
shift
;;
-LOG* | -LOg* | -Log* | -log* | -lOG* | -loG* | -lOg* )
if [ -d $2 ]
then
export LOG_HOME=$2
fi
shift
;;
-COO* | -COo* | -Coo* | -coo* | -cOO* | -coO* | -cOo* )
if [ -d $2 ]
then
export COOL_DIR=$2
fi
shift
;;
-CBD* | -CBd* | -Cbd* | -cbd* | -cBD* | -cbD* | -cBd* )
COOLBDAY=$2
shift
;;
-TES* | -TEs* | -Tes* | -tes* | -tES* | -teS* | -tEs* )
TEST="Y"
;;
-RELOAD* | -RESEND* | -reload* | -resend* | -Reload* | -Resend* )
RELOAD="Y"
esac



I understand, that parse_args, parsing arguments, which receive shell script, but it starts from crontab without any arguments
What arguments it is parsing?

Thanks for contribution
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Parsing the command line arguments

Is there a way to get the command line arguments. I am using getopt(3) but if the arguments are more than one for a particular option than it just ignores the second argument. For eg ./a.out -x abc def now abd will be got with -x using getopt "( x : )" and string abc\0def will get stored... (7 Replies)
Discussion started by: jayakhanna
7 Replies

2. Shell Programming and Scripting

How to pass arguments to a function in a shell script?

Hi, I have two shell variables $t1 and $t2 which I need to pass to a function in a shell script. The function will do some computation with those two variables and echo the resultant. But I do not know how to pass teh arguments. The function written is f1() {...... ........ } What should... (3 Replies)
Discussion started by: preetikate
3 Replies

3. Shell Programming and Scripting

no of arguments to function in shell script

Hi, I have a function in shell script fun1{ echo "No.of arguments are..."} this function will be called in same script by passing arguments fun 1 2 3 I want to check the no. of arguments passed to fun1 function in the same functionbefore validation. can any one suggest me. (2 Replies)
Discussion started by: KiranKumarKarre
2 Replies

4. Shell Programming and Scripting

Help parsing command line arguments in bash

Looking for a little help parsing some command line arguments in a bash script I am working on, this is probably fairly basic to most, but I do not have much experience with it. At the command line, when the script is run, I need to make sure the argument passed is a file, it exists in the... (3 Replies)
Discussion started by: Breakology
3 Replies

5. Shell Programming and Scripting

Parsing Comma separated Arguments

Hi unix guru's I want to execute a shell script like ksh printdetails.ksh Andy,Bob,Daisy,Johnson like passing all the four names in the as the arguments and these arguments are varies between 1 to 10. How to pass these names to the shell script variable. and also i want to know the count... (4 Replies)
Discussion started by: Reddy482
4 Replies

6. Shell Programming and Scripting

Need help with parsing the arguments using getopts !!

Hi all, I am trying to use long arguments for my existing script. right now my script would work if given <script_name> -t <arg1> -b <arg2> -v <arg3>. The script code is shown below. while getopts t:v:b: OPT;do case "$OPT" in t) Todo=$OPTARG;; b) Batch=$OPTARG;; ... (3 Replies)
Discussion started by: SSSB
3 Replies

7. Programming

Parsing command line arguments in Python

Hi, I've a python script called aaa.py and passing an command line option " -a" to the script like, ./aaa.py -a & Inside the script if the -a option is given I do some operation if not something else. code looks like ./aaa.py -a . . if options.a ---some operation--- if not options.a... (1 Reply)
Discussion started by: testin
1 Replies

8. Shell Programming and Scripting

Parsing Command Line Arguments In C shell script

]I have a string like "/abc/cmind/def/pq/IC.2.4.6_main.64b/lnx86" and this string is given by user. But in this string instead of 64b user may passed 32 b an i need to parse this string and check wether its is 32b or 64 b and according to it i want to set appropriate flags. How will i do this... (11 Replies)
Discussion started by: codecatcher
11 Replies

9. Shell Programming and Scripting

How to call Oracle function with multiple arguments from shell script?

Dear All, I want to know how can i call oracle function from shell script code . My oracle function have around 5 input parameters and one return value. for name in *.csv; do echo "connecting to DB and start processing '$name' file at " echo "csv file name=$x" sqlplus -s scoot/tiger <!... (2 Replies)
Discussion started by: Balraj
2 Replies

10. Shell Programming and Scripting

ksh parsing arguments in a string rather than from the cmdln

Hi. I have a piece of code that reads and parses command line options. I'd like to alter it slightly to read from a string (that's set elsewhere in the script) rather than directly from the command line (arg). Can somebody show me how to do this? Many thanks. My code is as follows: typeset... (6 Replies)
Discussion started by: user052009
6 Replies
platform::shell(n)					       Tcl Bundled Packages						platform::shell(n)

__________________________________________________________________________________________________________________________________________________

NAME
platform::shell - System identification support code and utilities SYNOPSIS
package require platform::shell ?1.1.4? platform::shell::generic shell platform::shell::identify shell platform::shell::platform shell _________________________________________________________________ DESCRIPTION
The platform::shell package provides several utility commands useful for the identification of the architecture of a specific Tcl shell. This package allows the identification of the architecture of a specific Tcl shell different from the shell running the package. The only requirement is that the other shell (identified by its path), is actually executable on the current machine. While for most platform this means that the architecture of the interrogated shell is identical to the architecture of the running shell this is not generally true. A counter example are all platforms which have 32 and 64 bit variants and where a 64bit system is able to run 32bit code. For these running and interrogated shell may have different 32/64 bit settings and thus different identifiers. For applications like a code repository it is important to identify the architecture of the shell which will actually run the installed packages, versus the architecture of the shell running the repository software. COMMANDS
platform::shell::identify shell This command does the same identification as platform::identify, for the specified Tcl shell, in contrast to the running shell. platform::shell::generic shell This command does the same identification as platform::generic, for the specified Tcl shell, in contrast to the running shell. platform::shell::platform shell This command returns the contents of tcl_platform(platform) for the specified Tcl shell. KEYWORDS
operating system, cpu architecture, platform, architecture platform::shell 1.1.4 platform::shell(n)
All times are GMT -4. The time now is 11:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy