Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Add parameter in UNIX from date Post 303005236 by RudiC on Monday 16th of October 2017 05:51:10 AM
Old 10-16-2017
Arithmetic operations expect NUMBERS to act upon, which e.g. 16/10/2017 is not. For which of your operations do you get that error? And, what is $5? Plus, why the square brackets?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing Date as parameter with sh script

Hi I need to pass a date argument with my shell script. Can any one send me code for the same. eg For 15th Aug 2006. Iwant to pass parameter like this ./startenv.sh 08/15/2006. Everyday date argument must change. Will the below code work ? ./startenv.sh date '+%m/%d/%y' THanks... (1 Reply)
Discussion started by: pankajkrmishra
1 Replies

2. Shell Programming and Scripting

passing date parameter in cronjob

Hi All, I have a crontab entry for every 5 min running. 5 * * * * /tmp/scripts/ksh/CsVues_H.sh `date +%Y%m%d_%H` >> /tmp/scripts/ksh/Cronresult.log and I am passing the date parameter. ( `date +%Y%m%d_%H` ) But the parameter values which i am expecting inside the script is... (6 Replies)
Discussion started by: scorpio
6 Replies

3. Shell Programming and Scripting

Shell script with date parameter

Hi All I have a shell script which calls all the Teradata Utiltyes . There is a sudden change in the requirment . What i'm asked to do is pass on the DATE to the shell script which should take the date automatically and run the utilityes. i.e. the date should not be passed on... (5 Replies)
Discussion started by: vinayrao
5 Replies

4. Shell Programming and Scripting

Incrementing the date depending on the Counter (parameter) passed to the script

Hello Everyone, I have been trying to complete a shell script where, I need to increment the date depending on the file (depending on the date) availability on the remote server. i.e. Basically, I will be passing a counter (like parameter 1 or 2 or 3 or 4). First I will check for the... (1 Reply)
Discussion started by: filter
1 Replies

5. UNIX and Linux Applications

Passing date parameter on Kshell command line

I need to execute a .ksh from command line. The ksh calls a control file and has 3 parameters. First parameter is a csv file, second the target table in oracle and third parameter is a date parameter. I am attempting the below from the ksh command line {code} => testfile.ksh filname.csv... (1 Reply)
Discussion started by: kobe24
1 Replies

6. Shell Programming and Scripting

help with date parameter

I have a file with timestamp in the file name FILE=DETAIL_20120419141952_CODE.txt I am using the below expression to derive the file name FILE=DETAIL_$(date +'%Y%m%d')*_CODE.txt echo gives me correct filename but when I call it as a paramter to another script its being taken as. ... (3 Replies)
Discussion started by: dsravan
3 Replies

7. Shell Programming and Scripting

Parameter file with changing date

Hi, I have a trigger file which looks like this abcdefgh_YYYYMMDD.trg The YYYYMMDD is the year, month and the date. So for example today the trigger file would be abcdefgh_20130703.trg similarly tomorrow it would be abcdefgh_20130704.trg I need to write a script to check if the trigger file... (2 Replies)
Discussion started by: halfafringe
2 Replies

8. Shell Programming and Scripting

Last date of month based on parameter

Hi All, How do i get the last date of a month in Unix based on a parameter value. My requirement is if i pass 03/05/2014 as parameter, then i shud get the output/return value as 2/28/2014 If i pass 03/31/2014 as parameter, the output/return value should be 03/31/2014 itself. Also,... (2 Replies)
Discussion started by: galaxy_rocky
2 Replies

9. Shell Programming and Scripting

Pass date (YYYY-MM-DD) as parameter and get Day

Hi, I have a requirement where I have to pass Date to a script and get the day from it. Ex If parameter is 2015-09-29 The output should be Tuesday. Can you please tell me how to get that? (6 Replies)
Discussion started by: ashwin3086
6 Replies

10. UNIX for Beginners Questions & Answers

How to replace a parameter(variable) date value inside a text files daily with current date?

Hello All, we what we call a parameter file (.txt) where my application read dynamic values when the job is triggered, one of such values are below: abc.txt ------------------ line1 line2 line3 $$EDWS_DATE_INSERT=08-27-2019 line4 $$EDWS_PREV_DATE_INSERT=08-26-2019 I am trying to... (1 Reply)
Discussion started by: pradeepp
1 Replies
bc(1)							      General Commands Manual							     bc(1)

NAME
bc - arbitrary-precision arithmetic language SYNOPSIS
[file...] DESCRIPTION
is an interactive processor for a language that resembles C but provides unlimited-precision arithmetic. It takes input from any files given, then reads the standard input. Options recognizes the following command-line options: Compile only. is actually a preprocessor for which invokes automatically (see dc(1)). Specifying prevents invoking dc, and sends the dc input to standard output. causes an arbitrary-precision math library to be predefined. As a side effect, the scale factor is set. Program Syntax L a single letter in the range through E expression; S statement; R relational expression. Comments Comments are enclosed in and Names Names include: simple variables: L array elements: L [ E ] stacks: L Other Operands Other operands include: Arbitrarily long numbers with optional sign and decimal point. ( E ) sqrt ( E ) length ( E ) number of significant decimal digits scale ( E ) number of digits right of decimal point L ( E , ... , E ) Strings of ASCII characters enclosed in quotes (""). Arithmetic Operators: Arithmetic operators yield an E as a result and include: is remainder (not mod, see below); is power). (prefix and append; apply to names) Relational Operators Relational operators yield an R when used as op Statements E { S ; ... ; S } if ( R ) S while ( R ) S for ( E ; R ; E ) S null statement break quit Function Definitions define L ( L ,..., L ) { auto L, ... , L S; ... S return ( E ) } Functions in -l Math Library Functions in the math library include: s(x) sine c(x) cosine e(x) exponential l(x) log a(x) arctangent j(n,x) Bessel function All function arguments are passed by value. Trigonometric angles are in radians where 2 pi radians = 360 degrees. The value of a statement that is an expression is printed unless the main operator is an assignment. No operators are defined for strings, but the string is printed if it appears in a context where an expression result would be printed. Either semicolons or new-lines can sepa- rate statements. Assignment to scale influences the number of digits to be retained on arithmetic operations in the manner of dc(1). Assignments to or set the input and output number radix respectively, again as defined by dc(1). The same letter can be used simultaneously as an array, a function, and a simple variable. All variables are global to the program. "Auto" variables are pushed down during function calls. When using arrays as function arguments or defining them as automatic variables, empty square brackets must follow the array name. The operator yields the remainder at the current scale, not the integer modulus. Thus, at scale 1, is .1 (one tenth), not 1. This is because (at scale 1) is 2.3 with .1 as the remainder. EXAMPLES
Define a function to compute an approximate value of the exponential function: Print approximate values of the exponential function of the first ten integers. WARNINGS
There are currently no (AND) or (OR) comparisons. The statement must have all three expressions. is interpreted when read, not when executed. parser is not robust in the face of input errors. Some simple expression such as 2+2 helps get it back into phase. The assignment operators: and are obsolete. Any occurences of these operators cause a syntax error with the exception of which is inter- preted as followed by a unary minus. Neither entire arrays nor functions can be passed as function parameters. FILES
desk calculator executable program mathematical library SEE ALSO
bs(1), dc(1). tutorial in STANDARDS CONFORMANCE
bc(1)
All times are GMT -4. The time now is 12:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy