172542/run-text-file-as-commands-in-bash
If I have a text file with a separate command on each line how would I make the terminal run each line as a command? I just don't want to have to copy and paste 1 line at a time. It doesn't HAVE to be a text file... It can be any kind of file that will work.
example.txt:
sudo command 1 sudo command 2 sudo command 3
You can make a shell script with those commands, and then chmod +x <scriptname.sh>, 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
You don't actually have to call the ...READ MORE
$0 will give you the complete basename. ...READ MORE
Hi@akhtar, There is no inbuild command available for ...READ MORE
Hi@akhtar, You can extract text from a file. ...READ MORE
I'm using Linux mint and using the ...READ MORE
Anyway, you need to print everything except ...READ MORE
Please check the below-mentioned syntax and commands: To ...READ MORE
Here is what you can do.Just use packagesmatching to ...READ MORE
Follow the below commands to install PostgreSQL (PSQL) ...READ MORE
Use the following to get the postgres prompt ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.