Thursday, May 2, 2024
36
rated 0 times [  36] [ 0]  / answers: 1 / hits: 79398  / 1 Year ago, sat, april 22, 2023, 10:32:27

I could (1) prepare a file with typed commands separated by end-line, (2) make it executable, (3) run it from a file-system manager or the terminal.



But this is ridiculous for not repeatable and every-time-other sets of commands.



Can I type those commands to the terminal in one request instead?



I don't know end-line character for the terminal - Ctrl, Shift or Alt with Enter doesn't work.  


More From » gnome-terminal

 Answers
4

You can separate commands with && or ;.




  • && only runs the next command if the previous one exited with status 0 (was successful) :



    command1 && command2 && command3

  • ; runs every commands, even if the previous one exits with a non zero status :



    command1; command2; command3



You can combine these separators as you wish.


[#27183] Monday, April 24, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cheeturage

Total Points: 432
Total Questions: 111
Total Answers: 115

Location: Bahrain
Member since Tue, Mar 1, 2022
2 Years ago
;