Run bash commands from txt file Run bash commands from txt file bash bash

Run bash commands from txt file


Just do bash file:

$ cat file dateecho '12*12' | bc$ bash fileMon Nov 26 15:34:00 GMT 2012144

In case of aliases just run bash -i file

No need to worry about file extensions or execution rights.


In a Terminal just type:

bash path/to/my/file.txt

And you will get each lines executed.


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