this post was submitted on 19 Aug 2023
4 points (100.0% liked)

Linux

2619 readers
26 users here now

Shit, just linux.

Use this community for anything related to linux for now, if it gets too huge maybe there will be some sort of meme/gaming/shitpost spinoff. Currently though… go nuts

founded 2 years ago
MODERATORS
 

Parental Guidance Required, might not be safe for some audiences.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 5 points 2 years ago (1 children)

The main problem is that if any of the commands fail, they'll just keep moving on to the next one.

You can get around this by using the && chaining operator.

Like

apt-get install curl && curl ... && apt ... && ...

That'll get around the worst of copy/pasting long strings, but writing a more robust shell script is a better option if you're doing it for anything important.

Also, if you're copy/pasting batches of commands from the Internet, just be aware that hidden text can be snuck into command suggestions, so it's best to copy paste into a text editor first and make sure you understand what it's doing before you run it.

[–] Maddison 3 points 2 years ago (1 children)

nice thank you for teaching me something

[–] [email protected] 3 points 2 years ago (1 children)

The other advantage to writing a script is you can assign a "sudo rule" to your account so you can run it without typing a password.

This would set that one script as passwordless sudo, without compromising the security of other things on the server.

Of course, this is all assuming you're doing it more than once, and in a more critical environment.

[–] Maddison 1 points 2 years ago

The other advantage to writing a script is you can assign a “sudo rule” to your account so you can run it without typing a password.

I like you lol! Thank you again mate!