Sponsored Content
Top Forums Programming Shell programming ksh AIX - beginner Post 302609467 by mroki on Tuesday 20th of March 2012 02:19:47 AM
Old 03-20-2012
Question

Hi!
Quote:
#!/usr/bin/ksh
# ==============================================================================
# Start/Log SH Script
# ==============================================================================

# Parameters
#. $HOME/.profile
. /app/ICSASC00/dts/sh/params.sh

cd $DTS_SH_DIR
LogDir=$DTS_SH_LOG

# log each execution
ThisScriptFullName="$0"
ThisScriptName=`basename $0`
ThisScriptName=${ThisScriptName%.*}
ThisScriptDir=`dirname $0`
ThisScriptLogFullName="$LogDir/$ThisScriptName.log"
#echo ThisScriptLogFullName=$ThisScriptLogFullName

Now=$(date +"%Y_%m_%d_%H_%M_%S")
echo "Execution begin at $Now" >>$ThisScriptLogFullName

RunScriptName=`basename $1`
RunScriptName2=${RunScriptName%.*}

# create log file for each execution
LogName=$RunScriptName2"_"$Now".log"
#echo LogName=$LogName

LogFullName="$LogDir/$LogName"
echo "%LogFullName%"=$LogFullName

echo "$1 $2 $3 $4 $5 $6 $7 $8" >>$ThisScriptLogFullName
echo "log: $LogFullName" >>$ThisScriptLogFullName

!!! call like (/usr/bin/ksh sqlldr rows=1000 userid=$pSourceConStr data=$vFlatFile control=$vCtlFile log=$vLdrLogFile bad=$vLdrBadFile >sqlldr_log.log)
!!! instead of that ($1 $2 $3 $4 $5 $6 $7 $8 >>$LogFullName) !!! this call is in 3.th script
!!! if I comment out this call, works fine

echo "%Return_Prameter%"=$?
echo "%Return_Prameter%"=$? >>$ThisScriptLogFullName

Now=$(date +"%Y_%m_%d_%H_%M_%S")
echo "End at $Now" >>$ThisScriptLogFullName

exit $?
of course I meant to comment out that call not directly from this script but from 3.th script
Quote:
echo "%Return_Prameter%"=$?
echo "%Return_Prameter%"=$? >>$ThisScriptLogFullName
Now=$(date +"%Y_%m_%d_%H_%M_%S") echo
"End at $Now" >>$ThisScriptLogFullName
exit $?
I got the echo-s to file >>$ThisScriptLogFullName
I do not get the echos to display and the exit value.
My question is how can I call the external program to do not redirect the echo-s from display and exit value
Thanks,
Mroki

Last edited by mroki; 03-20-2012 at 03:31 AM..
 

10 More Discussions You Might Find Interesting

1. AIX

Aix Shell Programming

HI I am trying to write a shell script which accepts two strings from user and finds the matching number of characters in those two ex: string 1 abcd string 2 bcgt result is bc (matching characters) pls provide me with a basic script for doing that (1 Reply)
Discussion started by: akmtcs
1 Replies

2. Shell Programming and Scripting

sed not working on AIX in ksh shell!

Hi All, I have this script which doesn't work on AIX ksh shell.. # ! /usr/bin/ksh grep -irl "6000" /home/applmgr/xyz > file_list_port.log xargs sed -i 's/6000/6010/g' < file_list_port.log But this same script has worked perfectly on linux bash shell.. Could anyone please share... (4 Replies)
Discussion started by: a1_win
4 Replies

3. Shell Programming and Scripting

Beginner Shell Programming Question

Hello all, I am currently try to learn the linux operating system as well as some bash programming. I have come across some online course work which has been very helpful, I have been working through some assignments and since I have no teacher to ask I have come to you experts. So the... (6 Replies)
Discussion started by: g2axiom
6 Replies

4. Shell Programming and Scripting

AIX ksh: how to pass variable to host shell

I have a script that "runs" a script. For example: ./runscript.ksh pcnmc01.ksh runscript puts pcnmc01.ksh into the background with log output going to the logfile. After executing the command, I get this output: Running script in the background: pcnmc01.ksh Logfile:... (2 Replies)
Discussion started by: Eben Yong
2 Replies

5. Programming

beginner to c programming

hii friends i m fairy new to c programming.can any one suggest some good websites and some good books for beginner (6 Replies)
Discussion started by: pankajchandel
6 Replies

6. AIX

Beginner's questions about AIX (6.1)

Hello, For some time I have intellistation 9111-285 and I installed AIX 6.1 on it. As a complete beginner I have 2 questions in general about AIX and two specific: 1. is the SMS (system management services) part of AIX? As I noticed when I had Yellowdog Linux installed they weren't available?... (2 Replies)
Discussion started by: kenashkov
2 Replies

7. Shell Programming and Scripting

Beginner in ksh - umask query

I started to learn KSH I am doing some exercises from the book $ umask =rx, u+w $ print Keep track of everythine > file1.out $ print Be careful >> file1.out ksh: file1.out: cannot create $ umask -S ... (1 Reply)
Discussion started by: solaris_user
1 Replies

8. Shell Programming and Scripting

A beginner needing some help programming documents

Hi all, I'm a fairly new beginner with shell programming and python programming. I have a mac (mountain lion OS 10.8.2) and use the terminal for programming. I'm trying to use the unix to easily organize some language data that I am working with. Basically I have to word lists, that I need to... (2 Replies)
Discussion started by: nomadblue
2 Replies

9. Shell Programming and Scripting

Shell Programming (beginner help)

So guys basically I was really sick and couldn't attend the labs and lectures and I went to my lecture hoping he would say ok I will help you from the start but he just said google it. So If it's possible to make the assignment and explain more in detail why is that would be really helpfull. I can... (1 Reply)
Discussion started by: Joola94
1 Replies

10. Shell Programming and Scripting

Unable to replace string in AIX ksh shell

My variable contains the following string I wish to replace \n with "space" so the expected output is: I understand that the /n is not a new linein this case. I'm on AIX using ksh shell. Below is all that I tried. echo $str | sed -e "s#\n# #g"; echo $str | sed -e "s#\n#' '#g";... (5 Replies)
Discussion started by: mohtashims
5 Replies
ROUND(3)								 1								  ROUND(3)

round - Rounds a float

SYNOPSIS
float round (float $val, [int $precision], [int $mode = PHP_ROUND_HALF_UP]) DESCRIPTION
Returns the rounded value of $val to specified $precision (number of digits after the decimal point). $precision can also be negative or zero (default). Note PHP doesn't handle strings like "12,300.2" correctly by default. See converting from strings. PARAMETERS
o $val - The value to round o $precision - The optional number of decimal digits to round to. o $mode - Use one of the following constants to specify the mode in which rounding occurs. +--------------------+---------------------------------------------------+ | Constant | | | | | | | Description | | | | +--------------------+---------------------------------------------------+ | | | | PHP_ROUND_HALF_UP | | | | | | | Round $val up to $precision decimal places away | | | from zero, when it is half way there. Making 1.5 | | | into 2 and -1.5 into -2. | | | | | | | |PHP_ROUND_HALF_DOWN | | | | | | | Round $val down to $precision decimal places | | | towards zero, when it is half way there. Making | | | 1.5 into 1 and -1.5 into -1. | | | | | | | |PHP_ROUND_HALF_EVEN | | | | | | | Round $val to $precision decimal places towards | | | the next even value. | | | | | | | |PHP_ROUND_HALF_ODD | | | | | | | Round $val to $precision decimal places towards | | | the next odd value. | | | | +--------------------+---------------------------------------------------+ RETURN VALUES
The rounded value EXAMPLES
Example #1 round(3) examples <?php echo round(3.4); // 3 echo round(3.5); // 4 echo round(3.6); // 4 echo round(3.6, 0); // 4 echo round(1.95583, 2); // 1.96 echo round(1241757, -3); // 1242000 echo round(5.045, 2); // 5.05 echo round(5.055, 2); // 5.06 ?> Example #2 $mode examples <?php echo round(9.5, 0, PHP_ROUND_HALF_UP); // 10 echo round(9.5, 0, PHP_ROUND_HALF_DOWN); // 9 echo round(9.5, 0, PHP_ROUND_HALF_EVEN); // 10 echo round(9.5, 0, PHP_ROUND_HALF_ODD); // 9 echo round(8.5, 0, PHP_ROUND_HALF_UP); // 9 echo round(8.5, 0, PHP_ROUND_HALF_DOWN); // 8 echo round(8.5, 0, PHP_ROUND_HALF_EVEN); // 8 echo round(8.5, 0, PHP_ROUND_HALF_ODD); // 9 ?> Example #3 $mode with precision examples <?php /* Using PHP_ROUND_HALF_UP with 1 decimal digit precision */ echo round( 1.55, 1, PHP_ROUND_HALF_UP); // 1.6 echo round( 1.54, 1, PHP_ROUND_HALF_UP); // 1.5 echo round(-1.55, 1, PHP_ROUND_HALF_UP); // -1.6 echo round(-1.54, 1, PHP_ROUND_HALF_UP); // -1.5 /* Using PHP_ROUND_HALF_DOWN with 1 decimal digit precision */ echo round( 1.55, 1, PHP_ROUND_HALF_DOWN); // 1.5 echo round( 1.54, 1, PHP_ROUND_HALF_DOWN); // 1.5 echo round(-1.55, 1, PHP_ROUND_HALF_DOWN); // -1.5 echo round(-1.54, 1, PHP_ROUND_HALF_DOWN); // -1.5 /* Using PHP_ROUND_HALF_EVEN with 1 decimal digit precision */ echo round( 1.55, 1, PHP_ROUND_HALF_EVEN); // 1.6 echo round( 1.54, 1, PHP_ROUND_HALF_EVEN); // 1.5 echo round(-1.55, 1, PHP_ROUND_HALF_EVEN); // -1.6 echo round(-1.54, 1, PHP_ROUND_HALF_EVEN); // -1.5 /* Using PHP_ROUND_HALF_ODD with 1 decimal digit precision */ echo round( 1.55, 1, PHP_ROUND_HALF_ODD); // 1.5 echo round( 1.54, 1, PHP_ROUND_HALF_ODD); // 1.5 echo round(-1.55, 1, PHP_ROUND_HALF_ODD); // -1.5 echo round(-1.54, 1, PHP_ROUND_HALF_ODD); // -1.5 ?> CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | The $mode parameter was introduced. | | | | | 5.2.7 | | | | | | | The inner workings of round(3) was changed to | | | conform to the C99 standard. | | | | +--------+---------------------------------------------------+ SEE ALSO
ceil(3), floor(3), number_format(3). PHP Documentation Group ROUND(3)
All times are GMT -4. The time now is 08:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy