Run bash commands from txt file

Solution 1:

Just do bash file:

$ cat file 
date
echo '12*12' | bc

$ bash file
Mon Nov 26 15:34:00 GMT 2012
144

In case of aliases just run bash -i file

No need to worry about file extensions or execution rights.

Solution 2:

In a Terminal just type:

bash path/to/my/file.txt

And you will get each lines executed.