". script.sh" will execute the script in the current environment, as if you had typed all the commands in script.sh at the command prompt. Therefore, an "exit" in the script will exit your session. Why not just chmod +x the script and run it by doing:
?
Hi! Is there is any way to divide the screen when I use UNIX shells (I have RedHat 7.1)? I have to see the command promt and process some data from very long file at the same time (I work with PThreads). Some "pseudo-windows" in text mode, huh? =) Thanks in advance and don't be angry =) (4 Replies)
I am trying to compare 2 float values using if
the foll code does not work
a=1.4
b=1.6
if test $a -gt $b
then
echo "$a is max"
else
echo "$b is max"
fi
does -gt work for floating point numbers, if not how do go about for my requirement? can i use bc ? pls help
thanks in advance... (2 Replies)
Good morning,
I'm testing the use of ceilf:
/*Filename: str.c*/
#include <stdio.h>
#include <math.h>
int main (void)
{
float ceilf(float x);
int dev=3, result=0;
float tmp = 3.444f;
printf("Result: %f\n",ceilf(tmp));
return 0;
} (1 Reply)
Today I spent longer than I'd like to admit figuring out how to write a Bourne shell IF statement that tests a FLOAT value before executing a block of statements. Here's the solution I found, which invokes bc. Hope this will come in handy for someone:
value =
testval =
if
then
body... (5 Replies)
Hi Guys,
here is a part of my source code. This part is reponsible to get the minimun of a few values:
..........
MAX=0.00
for a in `cat $OFILE`
do
if
then
... (2 Replies)
Hi all,
I am new to unix and I am trying hard to get this requirement, but no luck.
I am trying to compare two cloumns in two files and if it matches, the last column in file1 must be divided by file2 and the output must be written in a new file. To elaborate the 2nd column in file1 (EUR) must be... (6 Replies)
Hi,
I do have a very simple task to divide 2 variables and display the result.
I CANNOT use bc
when i try
var1=2
var2=4
var3=$(($var1 / $var2))
echo $var3
the output is always 0
What can I change to get a dotted decimal result such as 0.5 ?
Thanks! (5 Replies)
Hi,
I have small problem to print float value in the fallowing code
float Cx, W,f=250000, Cr=92.00,pi=3.14;
W=2*pi*f;
Cx = 1/W.Cr; //Cx value will be come around like 7.07E-9.
printf("capacitance value: %.10f",Cx);
I am trying to print Cx value using above code but it was not... (3 Replies)
Does anyone know how to include as a script maybe an "echo" warning that explains that if a user uses the second number "zero" when dividing, that the result will BE "zero."
I need, example: 5/0 (second number) = 0, in script form.
current script:
echo "Enter a number"
read num1
echo... (4 Replies)
Hello everyone, I have a dataset that looks like:
1 2
3 4
5 6
I was wondering if was possible to divide values within rows:
1/2
3/4
5/6
I don't think using awk -F"\t" '{ print $1/$2 }' would work here, or would it?
Thanks in advance! (2 Replies)