Sponsored Content
Homework and Emergencies Homework & Coursework Questions Help with bash shell scripting Post 302513137 by DGPickett on Tuesday 12th of April 2011 12:24:50 PM
Old 04-12-2011
Well, numbers often come from string data, for instance if first argument on the command line, "$1". You can read text in from the keyboard and pattern-test it to ensure it is valid text. Bash and ksh support $(( )), which does all sorts of integer arithmetic, e.g., z=$(( $z + 1 )), and if (( )), which allows all sorts of integer tests, e.g., if (( $z < 30 )). I am not sure they have a friendly floating point, probably. Let me google a bit . . . no, bash does not. I use dc or bc to do my floating point calculations within scripts, or move to a more formal language. The text from bc can be tested to see if it is negative, for instance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

bash shell scripting

Hi, i am new to UNIX. I have couple of basic questions. 1. Is the syntax for BASH shell programming same in the LINUX and SUN SOLARIS operating systems? 2. I have to work on BASH shell programming in SUN SOLARIS operating system. I am going through the documentation from the following... (4 Replies)
Discussion started by: azazalis
4 Replies

2. Shell Programming and Scripting

Help!! bash shell scripting..

Can any1 please help me... i'm really lost in using bash shell scripting... and i got to hand this up on monday... please anyone teach me how to do this assignment... Please use basic things because i just learn the program only... thanks ... (1 Reply)
Discussion started by: Fr0z3n999
1 Replies

3. Shell Programming and Scripting

Bash shell Scripting help

wwww wwwwwwww wwwwwwwwwwwww (0 Replies)
Discussion started by: keyvan
0 Replies

4. Shell Programming and Scripting

how to use regular expression in Bash Shell Scripting

Hi, Actually i have written one test.sh (shell program) in bash. Here i have a variables $a which stored the value package1. Now I want to write a regular expression inside the if command that "if $a variable contains letter p in the begining of the value package1 then it is coming true.... (5 Replies)
Discussion started by: sunitachoudhury
5 Replies

5. Shell Programming and Scripting

File handling with bash shell scripting

Hi all, Can anyone guide to get tricks for file handling in bash shell? Thanks in advance. Thanks Deepak (2 Replies)
Discussion started by: naw_deepak
2 Replies

6. Shell Programming and Scripting

bash shell scripting error need help urgently

#! /bin/sh abcd = "Hello world" if then echo $abcd fi i got error message that line3 : abcd: command not found line5 : [0: command not found line5 : [1: command not found i have no idea why i got this message. Can some one help me ??? (6 Replies)
Discussion started by: bonosungho
6 Replies

7. UNIX for Dummies Questions & Answers

File handling in bash shell scripting

i am new to shell scripting and stuck at one place in my program. i am reading data from one structured file and extracting some data from particular lines and then writing into the output file. In that reading input file line by line from while loop. while read line do rectype=line... (7 Replies)
Discussion started by: reeta_shri
7 Replies

8. Shell Programming and Scripting

Bash shell scripting doubt

Hello All, I am setting up a cron job, where i am calling a shell script to make few builds. I got struck at a point, need some expert inputs to proceed further. The script is categorized in 5 parts and in the last part while building software it asks for few questions like:- 1. Build mode... (4 Replies)
Discussion started by: sahil_jammu
4 Replies

9. UNIX for Dummies Questions & Answers

BASH Shell Scripting: If, Then Statement

I'm having trouble trying to create a BASH shell script. I want the user to input a command "cat file_name.c" and then the shell script will delete all comments "/* */" from file_name.c else exit. So far I have this: #!/bin/bash read "cat file" // User will input command cat... (7 Replies)
Discussion started by: inkjoy00
7 Replies

10. UNIX for Dummies Questions & Answers

Learn bash shell scripting

I do not know shell scripting. But at work place, I have got an in and out shell scripting task. I just need to understand a very big script. Is there any tool in which I can place the script and it can tell me the meaning of the whole script? (3 Replies)
Discussion started by: lg123
3 Replies
ilogbd64(3M)															      ilogbd64(3M)

NAME
ilogbd64(), ilogbd128(), ilogbd32() - decimal exponent functions SYNOPSIS
DESCRIPTION
The function computes the exponent of the floating point value x. Formally, the return value is the integral part of log base 10 of |x| as a signed integer value, for nonzero x. If x is subnormal, it is treated as though it were normalized, before the exponent is determined. is equivalent to for all values of x is a version of it takes a argument. is a version of it takes a argument. These math functions are supported for HP-UX 11i Version 3 September 2008 Update and forward. USAGE
To use any of these functions, compile with the option. Make sure your program defines and then includes Link in the math library by specifying or on the linking command line. For more information, see the at the following site: RETURN VALUE
If x returns and raises the invalid floating-point exception. If x is zero, returns and raises the invalid floating-point exception. If x is NaN, returns and raises the invalid floating-point exception. ERRORS
If x is NaN, sets to If x is zero or infinite, sets to SEE ALSO
frexpd64(3M), logbd64(3M), scalbnd64(3M), scalblnd64(3M), math(5). STANDARDS CONFORMANCE
These functions conform to ISO/IEC TR 24732, "Extension for the programming language C to support decimal floating-point arithmetic". HP Integrity Server Only ilogbd64(3M)
All times are GMT -4. The time now is 01:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy