bash:如何重新分配变量?

时间:2019-11-28 00:28:36

标签: bash variable-assignment

我想将comp的变量comp = "new_apple"从“ apple”更新为“ new_apple”,但效果不佳

   for comp in apple orange banana
   do
        if [ $comp == "apple" ];
        then
            echo "changing apple";
            $comp = "new_apple";
        fi;
        echo $comp
   done

0 个答案:

没有答案