You are not logged in.

#1 2020-11-20 12:40:29

buiola
Member
Registered: 2020-11-20
Posts: 2

Curiosity about the leave command, can anybody help?

Note for moderators: if this should be posted in a different forum or generates a flame war, please remove it, not my intention of causing problems.

This is a trivial question, just a curiosity that I hope experienced Arch users could help with, or maybe users coming from BSD, Debian or other unix-like distro? Unfortunately I don't have the necessary skills to investigate further.

I've just read one of the many articles about unix utilities and dig a bit around, finding this command mentioned in a few one-liners.

Couldn't try it obviously (command not found), but it looks like a poor man reminder, you input something like:

leave +2

and after a couple of minutes you are reminded to get away from your desk, if you don't, you keep getting reminded at set intervals. The only way to stop it is to kill the process.

It looks like it's present in Debian default stock, and I guess Ubuntu and other derivatives, so I wonder why not in Arch Linux? Or at least, I couldn't find it in any repo or in AUR. Maybe it's just a relic from the past that nobody bothered to remove in Debian?

I know that something like that can be achieved with a stupid bash script, that's not the reason I'm writing here. I'm more interested in understanding the history of this embedded executable (it seems it first appeared in BSD 3.0) and why, I suppose, Arch decided to not include it. Or maybe it's included in a package I don't know of?

Also, if you can access the Debian tar file, how difficult would it be to "port" it to Arch for a newbie?

Final question, do you know of any other "relic" command line utilities present in other Linux distros but not in Arch?

Thanks for any help you can give with this!

Offline

#2 2020-11-20 12:52:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 24,640
Website

Re: Curiosity about the leave command, can anybody help?

buiola wrote:

Also, if you can access the Debian tar file, how difficult would it be to "port" it to Arch for a newbie?

The source is available, so all you need is a PKGBUILD.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#3 2020-11-20 13:35:25

GaKu999
Member
From: US/Eastern
Registered: 2020-06-21
Posts: 523

Re: Curiosity about the leave command, can anybody help?

This sounds rather simple, you only make a process that sleeps for a set amount of time and after it, starting spamming the user trough every mean possible until he either kills it or actually leaves.

Could be done with simple scripts or C.
Tho I see it more straightforward with a shell script.


My reposSome snippets

Heisenberg might have been here.

Online

#4 2020-11-20 13:42:40

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 24,640
Website

Re: Curiosity about the leave command, can anybody help?

GaKu999, it is just about 100 lines of C - and frankly quite poorly written.  It could be about a dozen lines of C.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#5 2020-11-20 17:44:22

GaKu999
Member
From: US/Eastern
Registered: 2020-06-21
Posts: 523

Re: Curiosity about the leave command, can anybody help?

Trilby wrote:

GaKu999, it is just about 100 lines of C - and frankly quite poorly written.  It could be about a dozen lines of C.

I see (no I don’t see, my half asleep brain hasn’t found the source hmm, imagine I did, which I will do eventually...), tho I’m still fresh in C. Reason of my biaseness.

Tho OP would prefer to reimplement, even better with libnotify or equivalent support, and a notification daemon.
Or just make a loud beep boop sound with a generated voice saying “leave puny human!”


My reposSome snippets

Heisenberg might have been here.

Online

#6 2020-11-20 19:42:44

buiola
Member
Registered: 2020-11-20
Posts: 2

Re: Curiosity about the leave command, can anybody help?

Thanks guys, very informative, I should have had a look myself through the links on the Debian man page I posted initially.

Just in case, GaKu999, here is the source code for all the different versions, but as Trilby said, it's buggy even from a quick look at the page: there are compiling errors and warning and in 12 years nobody at Debian bothered fixing them, so I answered myself: Arch devs probably didn't want that mess for such a little program. Shame on people who suggest this command in the one-liners lists around for us newbies tough.

On a funnier note, you made me chuckle with the reference to the beep boop sound, which made me think about the "Initiated startup sequence" sexy voice in Knoppix, good old times...

Thanks again, and sorry for the stupid question but there's something to learn every day.

Offline

#7 2020-11-20 20:24:44

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 24,640
Website

Re: Curiosity about the leave command, can anybody help?

I didn't know it was buggy - in the sense that it could fail to do what it was supposed to.  I just looked at the code and was pretty disgusted: it is/was pretty poorly or clumsily coded.  I'd not want to be harsh if it was some young programmer's early dabbling in programming; for that it could earn some praise as a good start - but it's not of the quality to really be widely distributed.

Last edited by Trilby (2020-11-20 20:25:09)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

Board footer

Powered by FluxBB