如何将变量中的数值复制到bash脚本中的另一个变量。如果这是C,我会这样做
int a=0;
int b;
a=b;
我想这样做:
if [ $countip -gt $totalip ];
then
$countip -eq $srctip # <-- My problem is here!
echo $srctip
fi
说啊
countip=$srctip
这就是赋值在bash中的工作方式。这将把countip设置为srctip的值。如果你想分配srctip,那就写吧
srctip=$countip
根据下面的评论,这看起来像你想要的。