Run text file as commands in Bash

前端 未结 4 1591
滥情空心
滥情空心 2020-11-29 20:09

If I have a text file with a separate command on each line how would I make terminal run each line as a command? I just don\'t want to have to copy and paste 1 line at a tim

4条回答
  •  自闭症患者
    2020-11-29 20:57

    you can make a shell script with those commands, and then chmod +x , and then just run it by

    ./scriptname.sh
    

    Its very simple to write a bash script

    Mockup sh file:

    #!/bin/sh
    sudo command1
    sudo command2 
    .
    .
    .
    sudo commandn
    

提交回复
热议问题