The for construct is used to iterate through a list or repeatedly evaluate an expression. Using it for one single value is at least, hmmm, questionable, as the loop variable is set to exactly that single value.
I had different problem scenarios with IF statement. Can any expert please enlighten me on the difference with these scenarios. Thank you.
1st Scenario:
testdate=`date +%Y%m`
test=`cat /var/log/database0.$testdate*.log | grep "Errors found during processing" | tail -10`
if
then
... (4 Replies)
New to scripting in general, so patience plz. If I ask a stupid question or don't get it, I thank you for your kindness in advance.
That said, did a for i loops checks to see if a PB* file is there but I need to know two things before I copy the file.
I need to know if the file's create date... (2 Replies)
Hi,
Actually i stored all validdisks in one array and corresponding partitions required for all individual disks in other array..
Example:
Validdisks=dsk2 dsk3 dsk5
ValidPartition=4 4 3
Now i have to create domain..
Domain creation can be done by below commands:
fs_setup -d... (1 Reply)
I am kind of new in Unix and i have to make a menu. I want to put an if statement in the menu. you should enter the filename and it goes to that file. How do i do this? (1 Reply)
HI Unix Gurus,
I have a number of SELECT count(*) statements in an input file and I want to execute it using a shell script but one by one using loop in script....
How can I do this..... (7 Replies)
1. The problem statement, all variables and given/known data:
Two problems I need solving please. I created a script where the user types in 7 numbers as standard input and each one is then stored in an array. Now I need to perform the following calculations on those numbers:
1) Use a while... (11 Replies)
Hello. I am new here and new to scripting. I used to have a very basic script that worked for simple backup/restore of files. I have expanded it and well... I have ended up with a complete mess. It still backs up and restores but there is so many issues that stem from the many if statements I... (3 Replies)
Say I have a for loop that parse through a file....Say it look for the colors red and blue in sections of the file. Say it find red before it find blue in the file.
Say I have two if statements in the for loop
Something like if blue is found print blue is my favorite color is the first if... (7 Replies)
Discussion started by: scj2012
7 Replies
LEARN ABOUT LINUX
imaxdiv
DIV(3) Linux Programmer's Manual DIV(3)NAME
div, ldiv, lldiv, imaxdiv - compute quotient and remainder of an integer division
SYNOPSIS
#include <stdlib.h>
div_t div(int numerator, int denominator);
ldiv_t ldiv(long numerator, long denominator);
lldiv_t lldiv(long long numerator, long long denominator);
#include <inttypes.h>
imaxdiv_t imaxdiv(intmax_t numerator, intmax_t denominator);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
lldiv():
_XOPEN_SOURCE >= 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
or cc -std=c99
DESCRIPTION
The div() function computes the value numerator/denominator and returns the quotient and remainder in a structure named div_t that contains
two integer members (in unspecified order) named quot and rem. The quotient is rounded towards zero. The result satisfies quot*denomina-
tor+rem = numerator.
The ldiv(), lldiv(), and imaxdiv() functions do the same, dividing numbers of the indicated type and returning the result in a structure of
the indicated name, in all cases with fields quot and rem of the same type as the function arguments.
RETURN VALUE
The div_t (etc.) structure.
CONFORMING TO
SVr4, 4.3BSD, C89. The functions lldiv() and imaxdiv() were added in C99.
EXAMPLE
After
div_t q = div(-5, 3);
the values q.quot and q.rem are -1 and -2, respectively.
SEE ALSO abs(3), remainder(3)COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
2010-09-20 DIV(3)