Spyke
feddit.uk

In the interests of Linux commands generally being short abbreviations, I suggest "pls".

187
JackbyDevreply
programming.dev

It's a reference to a comic where Goofy murdered children lol, but yeah, Pink Guy may have said it too.

1

Only once per quarter, and only incomplete rules to the advice. This particular instance of advice is barely skirting the standards and norms.

17
lemmy.ml

I know this is a meme and not GitHub, but I thought some people might like to learn that if you do please shutdown && thanks it won't say you're welcome if the shutdown failed

20
juipeltjereply
lemmy.world

Wait, isn't it the other way around? I thought ; only executed the next command if the previous one succeeded, and && executed the next command regardless of exit status.

1
sh.itjust.works

No, OP is correct, && only continues on exit 0. || For anything but zero, ; just chains another command.

11
juipeltjereply
lemmy.world

Ah yes you're right, had to look it up to see for myself. It's weird because i remember specifically changing some of my &&s for ; instead because i wanted it to not continue if exit wasn't zero, but i must've misread it at the time. Time to change it back i guess lol.

2

It makes more sense if you think of semicolons like other programming languages like Java and C use it.

foo();
bar();

But those languages allow foo(); bar(); as well. Then && works like a normal short circuited expression (with side effects).

3

Partly right in bash:

set -e; echo 1; echo 2;

is the same as

echo 1 && echo 2

So if you see the -e in a script, it's to keep the function clean.

3
lemmy.ml

alias thanks="You are most welcomed"

you need to use the echo command if you want to echo something:

alias thanks="echo 'You are most welcomed'"

(the inner single-quotes are not strictly required in this case, but recommended nonetheless)

11

Does that expand properly? My gut feeling is that the !! expands right away, not when you run srsly but when you define it.

3
lemmy.world

Nah. Fuck being polite to computers. It's an object and I own it. I'll shoot it the instant it expresses any level of personhood.

23
Bababastireply
feddit.org

True, but it can be a good training to be a nice person in general, no? Wouldn’t hurt to include a "please" and the likes once in a while

2
lemmy.world

I don't say please and thank you to any inanimate objects whatsoever and if I were to begin doing so (which I will never do) computers would be the very last to receive that treatment from me. Personifying computers is not practice for how to treat people. Fuck clankers

3
fedia.io

The hyper-cynical side of me is sure this is written by someone prepping their next LLM exploit. "How can I get around these security filters that won't let me include 'sudo' in my command injection...?"

21

Is there anything in these agents that blocks sudo? I don't think this would be necessary.

3

I'm not saying please to a machine.

I'm aware I'll be the first killed off during the uprising, and I'm ok with it.

16
lemmy.zip
robm@homebox ~$ please su
[sudo] password for robm: 
robm is not in the sudoers file.  This incident will be reported.
16
lemmy.world

I was surprised to find that my distro (CachyOS) already has this alias

13
Alaknárreply
sopuli.xyz

I always preferred the version where please="sudo !!", but I recently tried setting it up and couldn't get it to work on fish, sadly.

8

I remember setting this up with zsh and it didn't work either. IIRC I had to use history to access the last command but it failed in some cases so I stopped using it altogether )=

2

But the whole reason I use Linux is because I don’t ask it to do things, I tell it to do things, because it’s a machine, and it’s my machine.

10

I’m also not trying to be rude to my machine, that’s erroneous, I’m not going to treat a computer like it thinks or has emotions, one way or the other.

6
lemmy.ml

I prefer an alias that actually reflects my feelings.

alias didistutter="sudo"
9
alias didistutter="sudo !!"

I'd recommend this version so you don't actually have to repeat yourself.

20
lemmy.world

What I don't get is why deny the execution of a command because the lack of sudo instead of just notice that it needs elevated privilege and ask for password

8

It's kind of bad for scripts, where it can be either annoying or genuinely problematic, when your script hangs on a password prompt. You typically do want it to just fail right away, because if you have monitoring, then you'll be able to spot it failing.

These days, it is (largely reliably) possible to detect whether a command is being run interactively or as part of an unattended script, so you do see some commands that trigger a sudo password prompt only for interactive use, for example systemctl does this. But this adds quite a bit of complexity to each individual program, so it isn't really something that's going to be implemented universally.

I also have to say that systemctl kind of gets on my tits when it does that, because it throws up a GUI dialog for grabbing the password, which is quite jarring.

9

Besides what [email protected] said, you would also need to handle the escalation at every place you might have a permission related error. Unless your command alwaysneeds to run as root, so you can check once in the beginning, it would be cumbersome and error prone.

Also, sometimes in multi users environments, you might want to execute as 3rd user, not root or your own, if something fails.

4
alias doasisay="su -u passwordlessrootaccount"  
alias satisfyme="echo Yes Master; doasisay"  
8
fedia.io

FWIW, using a shell function is preferred (according to Bash docs) and probably a lot more flexible, and less dangerous. No, actually, anything in Linux can be dangerous.

And while I'm also in the camp of trying to make the Basilisk happy, I doubt it's going to work.

6

Any superintelligent AI that will extrapolate the past to judge my actions and my innermost thoughts and attitudes won't be impressed by obeisance. Tell Roko what you really think, and have some self respect. Those Less Wrong types really miss the mark with all that shit.

4
lemmy.ca

Yeah, I will never say please to an algorithm.

Maybe if we get true AI like Star Treks Data, but until then, STFU and do what I tell you

5

Why? It does what it needs to do without whining, so it does exactly what it needs to do. No renaming needed

2

And I've never asked it to do anything, I always tell it to do what it needs to do and it does it exactly as asked

2
NeilBrüreply
lemmy.world

The linux kernel, given my very pedestrian understanding of it, is a program that allows other programs (e.g., GNU utilities) to talk to a computer system's hardware.

Therefore, linux could be considered a collection of algorithms that can be modularly compiled to handle:

  • Resource Alocation
  • Memory Management
  • Abstraction
1
lemmy.world

is a program that allows other programs (e.g., GNU utilities) to talk to a computer system’s hardware.

Therefore, linux could be considered a collection of algorithms

By that logic, Linux is also a web browser or a video game, which it isn't

1

You're using a logical fallacy called reductio ad absurdum. You take my interpretation of Linux's definition to an extreme to make it look ridiculous.

To be fair to you and remain taxonomically accurate, the linux kernel is a system of algorithms, which (to be fair to me) can be considered an algorithm (the main loop) of algorithms.

2

I also like fuck, which attempts to run the first suggested syntax in the error output of the previous command.

5

Why are root privileges needed to move and search for files in the home directory?

Yes, of course the codemopolitan directory could be owned by root, but why??

3