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

Linux

2380 readers
3 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 1 year ago
MODERATORS
 

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

top 6 comments
sorted by: hot top controversial new old
[–] [email protected] 9 points 1 year ago* (last edited 1 year ago) (1 children)

I don't know if it's a joke or not, but you should definitely write all those commands in a reusable script, and take care of the password one way or another. It could be run by a CI or anything else, and you won't be there to type this password. The usual question is: why do you want to run multiple commands at the same time? If you can answer this, you may find a better way to do this.

In your case, you can replace all the commands with sudo apt install firefox.

[–] Maddison -3 points 1 year ago* (last edited 1 year ago)

why do you want to run multiple commands at the same time? If you can answer this, you may find a better way to do this.

yeah, I am just lazy and don't want to sudo nano braveinstall.sh && chmod 700 braveinstall.sh

In your case, you can replace all the commands with sudo apt install firefox.

I hate the CEO of Mozilla, I hate them for running Firefox to the ground and they are politically active, so I don't want to support them anyway. I don't like to know the politics of tampons, ice creams & browsers, they should have kept their mouths shut.

[–] [email protected] 5 points 1 year 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 1 year ago (1 children)

nice thank you for teaching me something

[–] [email protected] 3 points 1 year 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 1 year 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!