What output will echo > produce?

后端 未结 2 1261
無奈伤痛
無奈伤痛 2021-01-23 11:16

I don\'t have a linux at hand and instead use compileonline.com to check out some code in bash, yet I\'m new to bash. Could somebody give a hand?

for var
do echo         


        
2条回答
  •  生来不讨喜
    2021-01-23 11:45

    It overwrites the file each time

    $ cat script.sh 
    for var in 123 abv xyz
    do
        echo $var > fniz
        cat fniz
    done
    $ ./script.sh 
    123
    abv
    xyz
    

    If you want to append, use >>

提交回复
热议问题