Hello I am trying to create a script that reads my file take all the variable it needs then use it for another command. But it seems that the variables are not being memorized, because I tried a printf instead of running my script and I got an empty output.
here is my code
#!/bin/bash
numparams=$#
params=$*
cat tots.txt | while read;
do awk '{
regid=$1;
uport=$2;
ongoingcalls=$3;
ingeg=$4;
maxcalls=$5;
if($3<$5) state=0
if($3==$5) state=1
if($3>$5) state=2
}'
/home/send_script.sh -o "$regid $uport $ongoingcalls $ingeg $maxcalls $state"
done
And here is the tots.txt content:
awk
variables are notbash
variables. You would need to assign the result ofawk
tobash
variables. But you don't needawk
at all in this case. I'd just usebash
features.test
aka[]
to setstate
and 2) the following snippet:while read line; do set $line; echo $1 $2 $3 $4; done
and you'll get where you want.