Run bash commands from txt file

前端 未结 4 672
耶瑟儿~
耶瑟儿~ 2020-12-08 00:11

I have some commands in txt file and I need to execute all them line by line. How could I do it?

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-08 00:26

    just change the extension of the file to .sh

    add /bin/bash at starting of the file

    change the permission of the file to executable

    than simply run ./filename.sh command in command line. all the commands in the file will be executed

提交回复
热议问题