Running several commands without && or ; or ()
+1
−3
I copy-paste several commands at once from a markdown editor (Typora) to Bash in a Putty window terminal; the file I work with reads as follows (empty lines included):
$ non sed command 1
$ non sed command 2
$ sed command 1
$ sed command 2
I want to just copy-paste everything and execute by pressing enter, but without using &&
or ;
or ()
.
What would be a good way to do so? Perhaps a function? Perhaps a Heredocument?
1 answer
+4
−0
A shell script!
You don't need a shebang line, just invoke it as /bin/sh script.sh
, but if you want to add one (e.g. perhaps you anticipate doing this more than once) Then you can copy the commands directly over to that file.
If you also want to copy the $'s, I don't see a way out of doing a little light editing after the copy.
1 comment thread