In general, composing Unix commands is a very powerful means to construct complex applications... poorly, with no real pathways to fixing their shortcomings. I believe the traditional "Unix Way" is to gloss over said shortcomings and pretend they don't exist, and when that fails, move the goalposts and argue that they don't exist "in the real world". For example, what combination of shell commands can I use to output…
Simple Unix Chat
141–150 of 175 posts
Re: Simple Unix Chat
#142In general, composing Unix commands is a very powerful means to construct complex applications... poorly, with no real pathways to fixing their shortcomings. I believe the traditional "Unix Way" is to gloss over said shortcomings and pretend they don't exist, and when that fails, move the goalposts and argue that they don't exist "in the real world". For example, what combination of shell commands can I use to output…
Whereas large scale enterprise commercial solutions make money by selling you on complete solutions that force you to relearn everything their way from the ground up. Just look at how AWS has hijacked so many concepts from the modern web and trapped people into building “cloud-agnostic” wrappers to try and wrangle the mess. Still we’re mapping onto their redesigns of the same old stuff.
At some level it’s unavoidable, hardware vendors need to agree on instructions after all, but when looking at the situation from a high level, it’s best to keep our ideals in mind and steer the ship so-as to find ourselves in paradise not lost in a sea of pirates.
One ideal: Modularity. Promotes healthy competition. Another ideal: Simplicity is more easily achieved when modular components may be used (and tested) in isolation.
Re: Simple Unix Chat
#143Earlier quoted context omitted.
You can't fix bugs in Slack so that seems hardly comparable. Screen sharing and video calls can be handled by other apps like Zoom, Google Meet etc.
I'm not talking about self-hosting suc, I'm arguing that all those extra lines of code in Mattermost (and presumably Slack) aren't doing nothing—a lot of them are a necessity if you're selling a software product.
Re: Simple Unix Chat
#144Earlier quoted context omitted.
Good first attempt. But: counts two links to the same file twice. That is: touch foo; ln foo bar Is this one file or two "links" to the same file? ;-0
You said files, not inodes. Those are two files sharing one inode. If you want to count inodes, specify that in the question.
Re: Simple Unix Chat
#145Earlier quoted context omitted.
I had a similar thought. But it also struck me that "externalising the maximalism" by using a library like the unix ssh implementation is probably the best way to go about it, since it's a widely used well tested library that implements a complex use case. In scientific programming I'd say that's the same as using a library like GSL, BLAS or even numpy. The net impact on LoC in my project is minimal, even though it c…
> But it also struck me that "externalising the maximalism" by using a library like the unix ssh implementation Not saying this to be argumentative, only to emphasize the same conflicting dynamic I saw in the post: this is exactly the same rationale that people routinely lambast here about NPM and other sources of dependencies. It’s libraries and frameworks all the way down. I’m cool with that, I’m just not cool with…
any dingbat with a terminal can produce an npm library that you can use in your application, the level of quality control is basically zero
but it takes a pretty strong track record to get your software into coreutils, or really any base linux distribution
to put it kind of cynically, i think there is an enormous difference between relying on ssh vs. relying on leftpad, gatekeeping based on competence measured over time is i think actually important and good to do
Re: Simple Unix Chat
#146In general, composing Unix commands is a very powerful means to construct complex applications... poorly, with no real pathways to fixing their shortcomings. I believe the traditional "Unix Way" is to gloss over said shortcomings and pretend they don't exist, and when that fails, move the goalposts and argue that they don't exist "in the real world". For example, what combination of shell commands can I use to output…
find . -type f -depth 1 -print0 | tr -d -c '\000' | wc -c GNU find has a -printf which would probably avoid the need to use tr. Personally, two hardlinks to the same underlying storage counts as two files to me, but I understand why you might disagree. I'd bet there's something out there that could give you only the count of unique storage areas, but I don't know how that interacts with deduplicating filesystems.
I had to modify it a bit to get it to work cross-platform, but the approach does appear to be sound:
find . -maxdepth 1 -type f -print0 | tr -d -c '\000' | wc -c
I had originally written "Hint: it probably isn't what you think it is, if it's even possible", but after testing for a bit, I updated my comment in what was apparently a fit of hubris to say you couldn't.Re: Simple Unix Chat
#147In general, composing Unix commands is a very powerful means to construct complex applications... poorly, with no real pathways to fixing their shortcomings. I believe the traditional "Unix Way" is to gloss over said shortcomings and pretend they don't exist, and when that fails, move the goalposts and argue that they don't exist "in the real world". For example, what combination of shell commands can I use to output…
|For example, what combination of shell commands can I use to output the number of files in a directory? Hint: it probably isn't what you think it is, if it's even possible. `find . -type f | wc -l`
touch first$'\n'file
touch .hidden$'\n'file
mkdir folder$'\n'.
touch folder$'\n'./another$'\n'file
There are two files in the folder, or three if you want to count files in subdirectories too.Your solution incorrectly outputs 7.
Re: Simple Unix Chat
#148In general, composing Unix commands is a very powerful means to construct complex applications... poorly, with no real pathways to fixing their shortcomings. I believe the traditional "Unix Way" is to gloss over said shortcomings and pretend they don't exist, and when that fails, move the goalposts and argue that they don't exist "in the real world". For example, what combination of shell commands can I use to output…
It isn't what I think it is? Oh. Then it must be: command ls -F directory | grep -v '[/@]$' | nl | tail -n 1 | cut -f 1 (-:
touch first$'\n'file
touch .hidden$'\n'file
mkdir folder$'\n'.
touch folder$'\n'./another$'\n'file
mkdir normal
touch normal/whatever
This folder has two files in it, or four if you count files in subdirectories.Your solution incorrectly outputs 3.
Re: Simple Unix Chat
#149This is an incredibly cool Showcase of the power of Unix command line utilities and their composability. However, I have to say, as someone who recently got into amateur system administration for a server that hosts several services I and my friends use m, I would not want to be responsible for maintaining this!
Re: Simple Unix Chat
#150Earlier quoted context omitted.
|For example, what combination of shell commands can I use to output the number of files in a directory? Hint: it probably isn't what you think it is, if it's even possible. `find . -type f | wc -l`
Good first attempt. But: counts two links to the same file twice. That is: touch foo; ln foo bar Is this one file or two "links" to the same file? ;-0