copy/paste multiple lines or line by line from siteA command-line clipboard copy and paste utility?Remove lines of code from multiple filesHow to uninstall youtube-dl by using terminalfish alias with a variable in the middle?Copy specific text from a multiple line file and paste it in another file automatically using terminalRemoving multiple patterns from fasta linesCopy/Paste loop code“Copy and Paste into Terminal” Option in Firefox/Nautilus Context Menu for Highlighted Text
What is the business model of discounted gift cards?
What is the name given to Jesus?
Why would shrinking TEMPDB log lead to slowness?
Would there be a difference between boiling whole black peppercorns or fine ground black pepp in a stew?
Why doesn't the nucleus have "nucleus-probability cloud"?
Length-terminated sequences
What does "crank old Sabbath" refer to?
Can you catch the thief?
Typesetting smilies in the input
Why do the Romance languages use definite articles, when Latin doesn't?
Electric motors - what for beginning?
Explanation for why nickel turns green in hydrochloric acid
Holding cost vs carrying cost vs storage cost
Princesses covering an 8x8 chess board
Problem with a commutative diagram
Is This Constraint Convex?
Copying files: Does Windows write to disk if files are identical
How long would it take to build 30 miles of Roman road?
Are commoners actually this squishy?
Which (if any) is the "most major" airport / field / strip on Antarctica?
Which are stars and which are noise in this comet photo?
Had J. K. Rowling seen This Is Spinal Tap before writing Harry Potter and the Philosopher's Stone?
Are homeless people protected by antidiscrimination laws?
Who is Alice referring to when she was talking to Kate?
copy/paste multiple lines or line by line from site
A command-line clipboard copy and paste utility?Remove lines of code from multiple filesHow to uninstall youtube-dl by using terminalfish alias with a variable in the middle?Copy specific text from a multiple line file and paste it in another file automatically using terminalRemoving multiple patterns from fasta linesCopy/Paste loop code“Copy and Paste into Terminal” Option in Firefox/Nautilus Context Menu for Highlighted Text
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
Simple question not a problem. If I am on a site like 'ask ubuntu' and looking to install a program, instead of using GUI, I just follow the CLI instructions. Sometimes they might have three or four lines, I copy/paste each line separately, is this the best or could I copy all lines as one block, then paste. I use fish shell and don't think it likes &&. Just wondering, thank you. An example sudo add-apt-repository ppa:appgrid/stable
Shows up a code box.
sudo apt-get update
sudo apt-get install appgrid
command-line
add a comment
|
Simple question not a problem. If I am on a site like 'ask ubuntu' and looking to install a program, instead of using GUI, I just follow the CLI instructions. Sometimes they might have three or four lines, I copy/paste each line separately, is this the best or could I copy all lines as one block, then paste. I use fish shell and don't think it likes &&. Just wondering, thank you. An example sudo add-apt-repository ppa:appgrid/stable
Shows up a code box.
sudo apt-get update
sudo apt-get install appgrid
command-line
add a comment
|
Simple question not a problem. If I am on a site like 'ask ubuntu' and looking to install a program, instead of using GUI, I just follow the CLI instructions. Sometimes they might have three or four lines, I copy/paste each line separately, is this the best or could I copy all lines as one block, then paste. I use fish shell and don't think it likes &&. Just wondering, thank you. An example sudo add-apt-repository ppa:appgrid/stable
Shows up a code box.
sudo apt-get update
sudo apt-get install appgrid
command-line
Simple question not a problem. If I am on a site like 'ask ubuntu' and looking to install a program, instead of using GUI, I just follow the CLI instructions. Sometimes they might have three or four lines, I copy/paste each line separately, is this the best or could I copy all lines as one block, then paste. I use fish shell and don't think it likes &&. Just wondering, thank you. An example sudo add-apt-repository ppa:appgrid/stable
Shows up a code box.
sudo apt-get update
sudo apt-get install appgrid
command-line
command-line
edited May 29 at 14:32
crip659
asked May 29 at 14:16
crip659crip659
1541 silver badge5 bronze badges
1541 silver badge5 bronze badges
add a comment
|
add a comment
|
2 Answers
2
active
oldest
votes
Make a text file and copy all lines there. Let's call it lines.txt
Then execute all commands of that file via
bash lines.txt
1
Runbash -eu
to let the script fail on error or unset variables.
– pLumo
May 29 at 14:57
So I am right to just copy/paste single line at a time, unless I want to do more work. Most of this is only single use, not likely to be used again. Remember I usually have to look up how to do most CLI stuff, unless it is simple copy/paste without having to add/change stuff.
– crip659
May 29 at 15:01
Doing it line-by-line is fine - usually it is only 3-5 lines anyway. What this solution does is the very same thing: instead of lettingbash
execute every line separately and by hand, you just make it execute one after the other - it just reads it from the textfile. Of course the textfile can be deleted in the end.
– Fiximan
May 29 at 15:03
Thanks, now I will google how to make a text file, thanks for your help.
– crip659
May 29 at 15:11
1
To create a file with some lines from pasting: Runcat > lines.txt
, then paste the lines, pressenter
,ctrl+d
. Done.
– pLumo
May 29 at 15:27
add a comment
|
You can paste the commands in a subshell and add set -eu
to make it fail on error and unset variables (or maybe better set -euo pipefail
):
Start a subshell with typing (
, end with )
, like this:
$ ( set -eu # press enter
> Paste multiple
> lines of code
> ) # press enter to run.
or similarly, run bash -euc 'multiple lines of code'
like this:
$ bash -euc ' # press enter
> paste multiple
> lines of code
> ' # press enter
Disclaimer: Do not paste anything of which you're not 100% sure what it does. Some people here even say you should not paste anything at all, but type it by yourself.
Will this work with 'fish shell' for first suggestion and for second can I just change 'bash' to 'fish'
– crip659
May 29 at 15:08
fish
can do-c
, and it can do-n
(only do syntax checking) which might be good option to do first. Not sure about-e
and-u
.
– pLumo
May 29 at 15:14
Thank you, basically just wanted to know if a code box/block was good to copy as whole or to do it line by line. It is good to know there are other ways of doing it, but for now I will stick with the line by line. It is nice and safe for me.
– crip659
May 29 at 15:30
add a comment
|
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1147138%2fcopy-paste-multiple-lines-or-line-by-line-from-site%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Make a text file and copy all lines there. Let's call it lines.txt
Then execute all commands of that file via
bash lines.txt
1
Runbash -eu
to let the script fail on error or unset variables.
– pLumo
May 29 at 14:57
So I am right to just copy/paste single line at a time, unless I want to do more work. Most of this is only single use, not likely to be used again. Remember I usually have to look up how to do most CLI stuff, unless it is simple copy/paste without having to add/change stuff.
– crip659
May 29 at 15:01
Doing it line-by-line is fine - usually it is only 3-5 lines anyway. What this solution does is the very same thing: instead of lettingbash
execute every line separately and by hand, you just make it execute one after the other - it just reads it from the textfile. Of course the textfile can be deleted in the end.
– Fiximan
May 29 at 15:03
Thanks, now I will google how to make a text file, thanks for your help.
– crip659
May 29 at 15:11
1
To create a file with some lines from pasting: Runcat > lines.txt
, then paste the lines, pressenter
,ctrl+d
. Done.
– pLumo
May 29 at 15:27
add a comment
|
Make a text file and copy all lines there. Let's call it lines.txt
Then execute all commands of that file via
bash lines.txt
1
Runbash -eu
to let the script fail on error or unset variables.
– pLumo
May 29 at 14:57
So I am right to just copy/paste single line at a time, unless I want to do more work. Most of this is only single use, not likely to be used again. Remember I usually have to look up how to do most CLI stuff, unless it is simple copy/paste without having to add/change stuff.
– crip659
May 29 at 15:01
Doing it line-by-line is fine - usually it is only 3-5 lines anyway. What this solution does is the very same thing: instead of lettingbash
execute every line separately and by hand, you just make it execute one after the other - it just reads it from the textfile. Of course the textfile can be deleted in the end.
– Fiximan
May 29 at 15:03
Thanks, now I will google how to make a text file, thanks for your help.
– crip659
May 29 at 15:11
1
To create a file with some lines from pasting: Runcat > lines.txt
, then paste the lines, pressenter
,ctrl+d
. Done.
– pLumo
May 29 at 15:27
add a comment
|
Make a text file and copy all lines there. Let's call it lines.txt
Then execute all commands of that file via
bash lines.txt
Make a text file and copy all lines there. Let's call it lines.txt
Then execute all commands of that file via
bash lines.txt
answered May 29 at 14:46
FiximanFiximan
1,2896 silver badges13 bronze badges
1,2896 silver badges13 bronze badges
1
Runbash -eu
to let the script fail on error or unset variables.
– pLumo
May 29 at 14:57
So I am right to just copy/paste single line at a time, unless I want to do more work. Most of this is only single use, not likely to be used again. Remember I usually have to look up how to do most CLI stuff, unless it is simple copy/paste without having to add/change stuff.
– crip659
May 29 at 15:01
Doing it line-by-line is fine - usually it is only 3-5 lines anyway. What this solution does is the very same thing: instead of lettingbash
execute every line separately and by hand, you just make it execute one after the other - it just reads it from the textfile. Of course the textfile can be deleted in the end.
– Fiximan
May 29 at 15:03
Thanks, now I will google how to make a text file, thanks for your help.
– crip659
May 29 at 15:11
1
To create a file with some lines from pasting: Runcat > lines.txt
, then paste the lines, pressenter
,ctrl+d
. Done.
– pLumo
May 29 at 15:27
add a comment
|
1
Runbash -eu
to let the script fail on error or unset variables.
– pLumo
May 29 at 14:57
So I am right to just copy/paste single line at a time, unless I want to do more work. Most of this is only single use, not likely to be used again. Remember I usually have to look up how to do most CLI stuff, unless it is simple copy/paste without having to add/change stuff.
– crip659
May 29 at 15:01
Doing it line-by-line is fine - usually it is only 3-5 lines anyway. What this solution does is the very same thing: instead of lettingbash
execute every line separately and by hand, you just make it execute one after the other - it just reads it from the textfile. Of course the textfile can be deleted in the end.
– Fiximan
May 29 at 15:03
Thanks, now I will google how to make a text file, thanks for your help.
– crip659
May 29 at 15:11
1
To create a file with some lines from pasting: Runcat > lines.txt
, then paste the lines, pressenter
,ctrl+d
. Done.
– pLumo
May 29 at 15:27
1
1
Run
bash -eu
to let the script fail on error or unset variables.– pLumo
May 29 at 14:57
Run
bash -eu
to let the script fail on error or unset variables.– pLumo
May 29 at 14:57
So I am right to just copy/paste single line at a time, unless I want to do more work. Most of this is only single use, not likely to be used again. Remember I usually have to look up how to do most CLI stuff, unless it is simple copy/paste without having to add/change stuff.
– crip659
May 29 at 15:01
So I am right to just copy/paste single line at a time, unless I want to do more work. Most of this is only single use, not likely to be used again. Remember I usually have to look up how to do most CLI stuff, unless it is simple copy/paste without having to add/change stuff.
– crip659
May 29 at 15:01
Doing it line-by-line is fine - usually it is only 3-5 lines anyway. What this solution does is the very same thing: instead of letting
bash
execute every line separately and by hand, you just make it execute one after the other - it just reads it from the textfile. Of course the textfile can be deleted in the end.– Fiximan
May 29 at 15:03
Doing it line-by-line is fine - usually it is only 3-5 lines anyway. What this solution does is the very same thing: instead of letting
bash
execute every line separately and by hand, you just make it execute one after the other - it just reads it from the textfile. Of course the textfile can be deleted in the end.– Fiximan
May 29 at 15:03
Thanks, now I will google how to make a text file, thanks for your help.
– crip659
May 29 at 15:11
Thanks, now I will google how to make a text file, thanks for your help.
– crip659
May 29 at 15:11
1
1
To create a file with some lines from pasting: Run
cat > lines.txt
, then paste the lines, press enter
, ctrl+d
. Done.– pLumo
May 29 at 15:27
To create a file with some lines from pasting: Run
cat > lines.txt
, then paste the lines, press enter
, ctrl+d
. Done.– pLumo
May 29 at 15:27
add a comment
|
You can paste the commands in a subshell and add set -eu
to make it fail on error and unset variables (or maybe better set -euo pipefail
):
Start a subshell with typing (
, end with )
, like this:
$ ( set -eu # press enter
> Paste multiple
> lines of code
> ) # press enter to run.
or similarly, run bash -euc 'multiple lines of code'
like this:
$ bash -euc ' # press enter
> paste multiple
> lines of code
> ' # press enter
Disclaimer: Do not paste anything of which you're not 100% sure what it does. Some people here even say you should not paste anything at all, but type it by yourself.
Will this work with 'fish shell' for first suggestion and for second can I just change 'bash' to 'fish'
– crip659
May 29 at 15:08
fish
can do-c
, and it can do-n
(only do syntax checking) which might be good option to do first. Not sure about-e
and-u
.
– pLumo
May 29 at 15:14
Thank you, basically just wanted to know if a code box/block was good to copy as whole or to do it line by line. It is good to know there are other ways of doing it, but for now I will stick with the line by line. It is nice and safe for me.
– crip659
May 29 at 15:30
add a comment
|
You can paste the commands in a subshell and add set -eu
to make it fail on error and unset variables (or maybe better set -euo pipefail
):
Start a subshell with typing (
, end with )
, like this:
$ ( set -eu # press enter
> Paste multiple
> lines of code
> ) # press enter to run.
or similarly, run bash -euc 'multiple lines of code'
like this:
$ bash -euc ' # press enter
> paste multiple
> lines of code
> ' # press enter
Disclaimer: Do not paste anything of which you're not 100% sure what it does. Some people here even say you should not paste anything at all, but type it by yourself.
Will this work with 'fish shell' for first suggestion and for second can I just change 'bash' to 'fish'
– crip659
May 29 at 15:08
fish
can do-c
, and it can do-n
(only do syntax checking) which might be good option to do first. Not sure about-e
and-u
.
– pLumo
May 29 at 15:14
Thank you, basically just wanted to know if a code box/block was good to copy as whole or to do it line by line. It is good to know there are other ways of doing it, but for now I will stick with the line by line. It is nice and safe for me.
– crip659
May 29 at 15:30
add a comment
|
You can paste the commands in a subshell and add set -eu
to make it fail on error and unset variables (or maybe better set -euo pipefail
):
Start a subshell with typing (
, end with )
, like this:
$ ( set -eu # press enter
> Paste multiple
> lines of code
> ) # press enter to run.
or similarly, run bash -euc 'multiple lines of code'
like this:
$ bash -euc ' # press enter
> paste multiple
> lines of code
> ' # press enter
Disclaimer: Do not paste anything of which you're not 100% sure what it does. Some people here even say you should not paste anything at all, but type it by yourself.
You can paste the commands in a subshell and add set -eu
to make it fail on error and unset variables (or maybe better set -euo pipefail
):
Start a subshell with typing (
, end with )
, like this:
$ ( set -eu # press enter
> Paste multiple
> lines of code
> ) # press enter to run.
or similarly, run bash -euc 'multiple lines of code'
like this:
$ bash -euc ' # press enter
> paste multiple
> lines of code
> ' # press enter
Disclaimer: Do not paste anything of which you're not 100% sure what it does. Some people here even say you should not paste anything at all, but type it by yourself.
edited May 29 at 15:04
answered May 29 at 14:55
pLumopLumo
11.2k1 gold badge24 silver badges51 bronze badges
11.2k1 gold badge24 silver badges51 bronze badges
Will this work with 'fish shell' for first suggestion and for second can I just change 'bash' to 'fish'
– crip659
May 29 at 15:08
fish
can do-c
, and it can do-n
(only do syntax checking) which might be good option to do first. Not sure about-e
and-u
.
– pLumo
May 29 at 15:14
Thank you, basically just wanted to know if a code box/block was good to copy as whole or to do it line by line. It is good to know there are other ways of doing it, but for now I will stick with the line by line. It is nice and safe for me.
– crip659
May 29 at 15:30
add a comment
|
Will this work with 'fish shell' for first suggestion and for second can I just change 'bash' to 'fish'
– crip659
May 29 at 15:08
fish
can do-c
, and it can do-n
(only do syntax checking) which might be good option to do first. Not sure about-e
and-u
.
– pLumo
May 29 at 15:14
Thank you, basically just wanted to know if a code box/block was good to copy as whole or to do it line by line. It is good to know there are other ways of doing it, but for now I will stick with the line by line. It is nice and safe for me.
– crip659
May 29 at 15:30
Will this work with 'fish shell' for first suggestion and for second can I just change 'bash' to 'fish'
– crip659
May 29 at 15:08
Will this work with 'fish shell' for first suggestion and for second can I just change 'bash' to 'fish'
– crip659
May 29 at 15:08
fish
can do -c
, and it can do -n
(only do syntax checking) which might be good option to do first. Not sure about -e
and -u
.– pLumo
May 29 at 15:14
fish
can do -c
, and it can do -n
(only do syntax checking) which might be good option to do first. Not sure about -e
and -u
.– pLumo
May 29 at 15:14
Thank you, basically just wanted to know if a code box/block was good to copy as whole or to do it line by line. It is good to know there are other ways of doing it, but for now I will stick with the line by line. It is nice and safe for me.
– crip659
May 29 at 15:30
Thank you, basically just wanted to know if a code box/block was good to copy as whole or to do it line by line. It is good to know there are other ways of doing it, but for now I will stick with the line by line. It is nice and safe for me.
– crip659
May 29 at 15:30
add a comment
|
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1147138%2fcopy-paste-multiple-lines-or-line-by-line-from-site%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown