Surely there's an easier way to do this, lets see if anyone knows! I am new to scripting so go easy on me!
I have the following script and at the moment it doesn't work and I believe the problem is that I am using a while loop within a while loop. When I run the script using sh -x I can see... (6 Replies)
her i am trying to edit a database file which is actually a small file holding my friend's name and birthdays
My Database
DEEPAK 27/08
DEEPIKA 18/02
DHYAN 23/03
DIPANKAR 24/10
SNIGDHO 19/05
AYANNAR 17/12
BHAI 22/09
DEBAN 16/08
JAGADISH 02/06
SUBHOJIT 23/02
TOJO 17/09
SUDHIR 12/09... (1 Reply)
Hey, I'm running knoppix and I'm trying to run a shell script to change multiple lines of text in multiple files
#!/bin/sh
for i in 'ls-1 test'
do
sed 's/bob/manny/'g $i > $i.0
mv $i.0 $i
done
Obviously this isn't the original file, but it's on another non-networked machine.
What... (7 Replies)
Hey guys,
I'm kinda a noob at scripting. I am trying to create a script that uses multiple for loops with the lsiutility to monitor disk health on a system.
The script runs, but it will continually echo an infinite number of LogVolumes when there are only 2 per virtual disk on my server. It's... (2 Replies)
Hi guys, I am a newbie to shell scripting.Please help me to accomplish this task. Its very urgent,I should create a script which will do the following:
i) "cd ~joseph/ ; mkdir -p Bing/Bong ;mkdir -p Bing/Bang" and then create 15 ".txt" files with content "Bing Bang Bong" in "Bong"... (1 Reply)
You can use one while inside another?
I made the following script (without really knowing if I can use two while) to get 3 numbers different from each other at random:
num1=$(( $RANDOM % 10 ))
num2=$num1
while
do
num2=$(( $RANDOM % 10 ))
done
num3=$num1
while
do
while
do... (1 Reply)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
Hello all,,, I am trying to finish my assignment for my CNET class. I am running into 2 problems... First the "Delete a file" (Option 1) When I run this option everything... (5 Replies)
I am trying to create a shell script similar to ls, but which only lists directories. I have the first half working (no argument version), but trying to make it accept an argument, I am failing. My logic is sound I think, but I'm missing something on the syntax, I'm guessing in the bolded line? ... (9 Replies)
I'm limited in my skills related to *nix and I'm even more limited in my skills related to shell scripting and the use of awk. I have what should be a relatively simple shell script that looks in the /etc/fstab to see if a particular partition exists on the Linux system. The intention of this part... (2 Replies)
Hello. I hava homework for university but i cant do it and i need a little help if someone can help me :) I have to do a linux shell script.
Write a script that does the following:
1. Check if there is a directory in / home with myDir name.
If not, it creates it.
2. In the directory it... (1 Reply)
Discussion started by: alex4o0o
1 Replies
LEARN ABOUT MOJAVE
check_uint64_sub
CHECK_INT32_ADD(3) BSD Library Functions Manual CHECK_INT32_ADD(3)NAME
check_int32_add, check_uint32_add, check_int64_add, check_uint64_add, check_int32_sub, check_uint32_sub, check_int64_sub, check_uint64_sub,
check_int32_mul, check_uint32_mul, check_int64_mul, check_uint64_mul, check_int32_div, check_uint32_div, check_int64_div, check_uint64_div,
-- detect overflow in arithmetic
SYNOPSIS
#include <checkint.h>
int32_t
check_int32_add(int x, int y, int *err);
uint32_t
check_uint32_add(int x, int y, int *err);
int64_t
check_int64_add(int x, int y, int *err);
uint64_t
check_uint64_add(int x, int y, int *err);
int32_t
check_int32_sub(int x, int y, int *err);
uint32_t
check_uint32_sub(int x, int y, int *err);
int64_t
check_int64_sub(int x, int y, int *err);
uint64_t
check_uint64_sub(int x, int y, int *err);
int32_t
check_int32_mul(int x, int y, int *err);
uint32_t
check_uint32_mul(int x, int y, int *err);
int64_t
check_int64_mul(int x, int y, int *err);
uint64_t
check_uint64_mul(int x, int y, int *err);
int32_t
check_int32_div(int x, int y, int *err);
uint32_t
check_uint32_div(int x, int y, int *err);
int64_t
check_int64_div(int x, int y, int *err);
uint64_t
check_uint64_div(int x, int y, int *err);
DESCRIPTION
The check_<type>_<operation>(x, y, err) family of functions perform the specified arithmetic operation (addition, subtraction, multiplica-
tion, or division) with the left operand of x and right operand of y and return the arithmetic result with the specified type.
Either operand x or y (or both) can be of any type that is compatible to signed or unsigned 8-bit, 16-bit, 32-bit, or 64-bit integers.
The err argument is or'ed by flags in the function to indicate if an overflow has occurred. The possible flag values are:
CHECKINT_NO_ERROR no overflow has occurred
CHECKINT_OVERFLOW_ERROR overflow has occurred
CHECKINT_TYPE_ERROR operand is of an incompatible type
The err argument is not cleared in calls to the check_<type>_<operation>(x, y, err) functions. Detected overflow persists in the err argu-
ment until err is reset to CHECKINT_NO_ERROR.
RETURN VALUES
If successful, the check_<type>_<operation>() functions will return the arithmetic result of performing the operation with left operand x and
right operand y (even when overflow error occurs).
If any other error occurs, the return value is -1 and the argument err will be set to indicate the error.
EXAMPLES
/* Create a variable to store overflow flag */
int32_t err = CHECKINT_NO_ERROR;
/* Use checkint API to perform an arithmetic operation and
* store result in variable. */
int32_t arithmetic_result = check_int32_add(UINT_MAX, 1, &err);
/* Check status of overflow flag */
if (err & CHECKINT_OVERFLOW_ERROR) {
/* Perform overflow resolution code */
fprintf(stderr, "Overflow detected!
");
}
/* Check for type error */
else if (err & CHECKINT_TYPE_ERROR) {
/* Deal with incompatible types error */
fprintf(stderr, "Incompatible types!
");
}
/* Reset overflow flag for next operation */
err = CHECKINT_NO_ERROR;
ERRORS
The check_<type>_<operation>() functions may fail if:
[CHECKINT_TYPE_ERROR] operand is of an incompatible type
HISTORY
The checkint() API was introduced in Mac OS X 10.5.
BSD April 20, 2007 BSD