This is a very simple function called i_upper_case , you can probably guess what it does. The backslash at the end of the echo line is a UNIX feature that allows a command line to be continued on the next line. It tells the system to ignor the next character - in this case the newline. Note that it gets its input argument from a passed parameter ($1). So to make use of this function within a script you simply need to call it with an argument as follows:
So when I created a function as follows
Code:
######Set Path Variables
echo -==Set Path Variables==- > `cat /export/home/mldwh/rkem_refresh/logs/rkem_log_dir`$TEST
RKEM_LOG=`cat /export/home/mldwh/rkem_refresh/logs/rkem_log_dir`
RKEM_SCRIPT=`cat /export/home/mldwh/rkem_refresh/logs/rkem_script_dir`
RKEM_LOAD_FILES=`cat /export/home/mldwh/rkem_refresh/logs/rkem_load_dir`
echo -==RKEM_LOG $RKEM_LOG==- >> $RKEM_LOG$TEST
echo -==RKEM_SCRIPT $RKEM_SCRIPT==- >> $RKEM_LOG$TEST
echo -==RKEM_LOAD_FILES $RKEM_LOAD_FILES==- >> $RKEM_LOG$TEST
######Set Username and Password Variables
echo -==Set Password Variables==- >> $RKEM_LOG$TEST
IDB1USER=`cat /export/home/mldwh/maintenance/connectivity/idb1user.txt`
IDB1PWD=`cat /export/home/mldwh/maintenance/connectivity/idb1pwd.txt`
TPCUSER=`cat /export/home/mldwh/maintenance/connectivity/tpcuser.txt`
TPCPWD=`cat /export/home/mldwh/maintenance/connectivity/tpcpwd.txt`
echo -==IDB1USER $IDB1USER==- >> $RKEM_LOG$TEST
echo -==IDB1PWD $IDB1PWD==- >> $RKEM_LOG$TEST
echo -==TPCUSER $TPCUSER==- >> $RKEM_LOG$TEST
echo -==TPCPWD $TPCPWD==- >> $RKEM_LOG$TEST
RKEM_Mainframe_time ()
{
######Connect to IDB1 and capture the current time of the system
echo -==Connect to IDB1 and capture the current time of the system==- >> $RKEM_LOG$TEST
db2 "connect to idb1 user $IDB1USER using $IDB1PWD" >> $RKEM_LOG$TEST
db2 -x "select current timestamp from sysibm.sysdummy1" > $RKEM_LOG"rkem_mainframe_system_date_time.txt"
db2 -x "select current date from sysibm.sysdummy1" > $RKEM_LOG"rkem_mainframe_system_date.txt"
db2 -x "select current time from sysibm.sysdummy1" > $RKEM_LOG"rkem_mainframe_system_time.txt"
db2 Terminate
echo -==Mainframe System Date Time `cat $RKEM_LOG"rkem_mainframe_system_date_time.txt"`==- >> $RKEM_LOG$TEST
echo -==Mainframe System Date `cat $RKEM_LOG"rkem_mainframe_system_date.txt"`==- >> $RKEM_LOG$TEST
echo -==Mainframe System time `cat $RKEM_LOG"rkem_mainframe_system_time.txt"`==- >> $RKEM_LOG$TEST
}
And then do the following SH script
Code:
TEST="TESTLOG.LOG"
RKEM_Mainframe_time $TEST
The function works correctly. Is there any danger concerning this variable not getting set correctly by calling it this way?
hi 2 all,
I'm trying 2 print " ' " in an awk statement but the sign deosn't show.
The only way I came with is 2 declare the ' as a variable and call that variable.
I'm trying 2 do:
awk '{printf("insert into ba_memo_01 values ('%s');",$1)}'
and get the output:
insert into ba_memo_01 values... (7 Replies)
I am looking to find something in the hour(in field $2) of 03:00:07 and 04:00:07 and 05:00:07 and must contain something in field 4... why doesn't below command work?
I try to use grep .. but since I am running this in loop, it's best I use the awk ..
can someone please advise.. I am pretty... (1 Reply)
hello
im working on a project for the iphone to write a termainal based program
we have bsd subsystem installed so have access to most unix command
i have a executable called coordinates, which get the coordinates of the iphone
when this runs it returns to the terminal the text of... (1 Reply)
Can someone tell me what exactaly the following command is doing -
pid_cmd="/usr/ucb/ps -axww | /usr/bin/egrep '${SUNMC2OSS_PATH}/SunMC2OSS\.jar.* sunmc2oss\.SunMC2OSS\$' | /usr/bin/egrep -v egrep | /usr/bin/nawk '{print \$1}'"
Is the egrep is to check "sunmc2oss.SunMC2OSS" process inside... (2 Replies)
I need to validate the special characters of a date (the characters between the year and month & month and day). The data filed is being populated by users and read into the script vi an argument. I want to ensure that the date is a '-' (dash) and not a '/' or '\' (slash).
The every thing I... (3 Replies)
Please let me know if I can use -F option and - V in a single awk statment. I want to import some comma separated shell variables using -F option and defining some static variables inside awk using -v option. (2 Replies)
Hi
what's the correct way of writing if
1)if "$time_diff" -gt 5
then
echo "killing hung process \n"
fi
2)if test $time_diff -gt 5
then
echo "killing hung process \n"
fi
where -time_diff=$(($Sam - $current_min))
and current_min=`date +%M`
infact both are giving Syntax... (1 Reply)
Hello everyone
I was hoping someone could tell me whether I can use a wildcard inside an tcsh if statement.
I am trying to test the argument the user has fed the script and whether it is a .txt file.
The Ides behind it is the following
if (`echo $1` != *.txt) then
echo "wrong... (6 Replies)
I am fairly new to writing scripts, and have gotten a lot of help from this site in the past with many of the posts.
I have a question/issue with a script I am attempting to write and have a question regarding executing an sql statement inside of a loop (do while). I have in the past written... (1 Reply)
Hello,
im creating a csv file for email reporting on issues.
my problem is that after 'continue' command in if statment in a loop
the new paramter writing into the log doesnt take new line.
timeout 4s zabbix_get -I $ZBX -p $PORT -s $IP -k "system.run"
if ; then
... (3 Replies)