Hi,
I have placed the script and running successfully on AIX
However in Linux it throws integer expression expected
Could some one please help me to fix this
MaxThreshold4alert=`echo "$MaxCapacitycnt*(80/100)" |bc -l`
echo $MaxThreshold4alert
Error:
40.00000000000000000000: integer expression expected
basically I need to get only the number 40 in the output
Code:
#!/bin/sh
CURRENTSTATE=2
CSVCSTATE=2
LASTSTATECHANGE=8
CSVCSTATEAGE=5
if (($CURRENTSTATE==$CSVCSTATE))&&(($LASTSTATECHANGE>=$CSVCSTATEAGE))
echo GREAT
fi
returns:
Code:
./aff: line 12: syntax error near unexpected token `fi'
./aff: line 12: `fi'
what am i doing wrong here?
sometimes, when the numbers are in notation, i also get an error.
I'm under Ubuntu 11.10, when i excute this program in bash i have error :
exec.bash: line 25: [: 0.1: integer expected as an expression
ligne 25 is :
while [ $p -le 1.0 ]
p=0.1
while [ $p -le 1.0 ]
do
echo ----probability---- $p
java $jvmargs -classpath $CP jbenchmarker.MainSimulation $p
(( p= $p + 0.1 ))
done
where is problem please ?
HI guys i am new to programing world, i have found one more wish with command line argument.
I have a shell script say one.sh ,
file_name=$1 //first argument file name(two.sh)
//connect to ftp and download $file_name
bash $file_name $2 $3 $4 //2nd 3rd and 4th arguments
say $file_name "actual name is two.sh, in two.sh
.....
.....
chmod 777 script.sh
I'm learning the basics of shell programming, so I wrote something simple like
#!/bin/bash
read var1
read var2
if [ var1 -lt var2 ]; then
echo "var1 is lt var2"
else
echo "var2 is lt var1"
fi
My understanding is that variables are untyped in Bash, and that any variable may be used as an integer if it only contains digits.
I am trying to run following condition with both variables having numeric values "1,2,3"
Code:
if [ '$NEW_STATE' -gt '$OLD_STATE' ];
when i run it i get following error:
Code:
$NEW_STATE: integer expression expected
Please correct me where I'm doing wrong.
I'm trying to check either New State is greater or Old state.
I would like to simply re-assign a variable (to be specific, increment it by 0.050) in a bash script. In the following script that I wrote, i is an (integer) index, and mytime is a decimal/double/float number.
Hi, this's Pom. I'm quite a new one for shell script but I have to do sql on shell script to query some information from database.
I found a concern to get a new line...When I run my script, it retrieves all data as wondering but it's shown in one line :(
What should I do?
I am new to shell scripts and many books have written that use #!(sha-bang) line in starting of the script to invoke the interpreter .And this will invoke a new shell for script and do the interpretation line by line.But one of my basic script is still running without the magic line.
so my questions are:
from where did my basic script get the interpreter.
how did the script manages to locate th