Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Toshimo
Aug 23, 2012

He's outta line...

But he's right!

Volguus posted:

Hey man, it's a chat program. Do you know how hard it is to write a chat program? Cut them some slack, that's a complicated piece of software.

I see what you did there.

Adbot
ADBOT LOVES YOU

susan b buffering
Nov 14, 2016

Wipfmetz posted:

... because FIND searches through filecontents, not filenames. You want DIR for that one.

the op is talking about the linux find utility, not the windows command

Toshimo
Aug 23, 2012

He's outta line...

But he's right!

susan b buffering posted:

the op is smugposting about the linux find utility, not the windows command

zergstain
Dec 15, 2005


I'm not sure if DIR in Windows works the same way, but I'm pretty sure the reason I don't use ls to find files is because shell globbing doesn't work very well with a recursive directory search.

QuarkJets
Sep 8, 2008

Wipfmetz posted:

... because FIND searches through filecontents, not filenames. You want DIR for that one.

Different find tool; you can open up WSL and use `find /mnt/c/ -name libcef.dll`. This will only search file names

nielsm
Jun 1, 2009



Use PowerShell, don't be a caveman.
code:
Get-ChildItem -Recurse -Path C:\ -Filter libcef.dll -ErrorAction SilentlyContinue
Or the same if you insist on being terse:
code:
gci -r C:\ libcef.dll -ea 0
You can also leave out the -ErrorAction part if you want to hear about all the directories you don't have permissions to access.

E: (I only find 4 copies on my work computer.)

FlapYoJacks
Feb 12, 2009
The real coding horror is that awful syntax for a simple search. The Linux equivalent:

find /usr -name libcef.dll

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

FlapYoJacks posted:

The real coding horror is that awful syntax for a simple search. The Linux equivalent:

find /usr -name libcef.dll

the "terse" version looks barely any different from yours, just some variation in order/name of arguments

FlapYoJacks
Feb 12, 2009

Hammerite posted:

the "terse" version looks barely any different from yours, just some variation in order/name of arguments

I should have specifically mentioned powershell syntax.

Athas
Aug 6, 2007

fuck that joker

nielsm posted:

Use PowerShell, don't be a caveman.
code:
Get-ChildItem -Recurse -Path C:\ -Filter libcef.dll -ErrorAction SilentlyContinue
Or the same if you insist on being terse:
code:
gci -r C:\ libcef.dll -ea 0
You can also leave out the -ErrorAction part if you want to hear about all the directories you don't have permissions to access.

E: (I only find 4 copies on my work computer.)

What if you want to search all drives? (Holy poo poo, Windows still uses drive letters?)

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Athas posted:

What if you want to search all drives? (Holy poo poo, Windows still uses drive letters?)

Do you want to explain to every boomer Karen where the C drive went?

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

leper khan posted:

Do you want to explain to every boomer Karen where the C drive went?
or, for that matter, everyone's favourite piece of legacy software that concatenates a bunch of strings and says "tada, here's a path"

Volte
Oct 4, 2004

woosh woosh
I like the drive letter system personally, and Windows supports mount points instead of drive letters for additional volumes if you really want that.

repiv
Aug 13, 2009

Athas posted:

(Holy poo poo, Windows still uses drive letters?)

kind of but also not really, the lower level parts of the system moved on from drive letters a long time ago. you can mount a drive to a path, similar to linux mounting, without giving it a letter.

drive letters are now just a high level UX thing for the sake of user familiarity

CPColin
Sep 9, 2003

Big ol' smile.
Remember when you could crash somebody's Windows system by tricking them into opening the path /CON/CON ? Good times.

QuarkJets
Sep 8, 2008

nielsm posted:

Use PowerShell, don't be a caveman.
code:
Get-ChildItem -Recurse -Path C:\ -Filter libcef.dll -ErrorAction SilentlyContinue
Or the same if you insist on being terse:
code:
gci -r C:\ libcef.dll -ea 0
You can also leave out the -ErrorAction part if you want to hear about all the directories you don't have permissions to access.

E: (I only find 4 copies on my work computer.)

"don't be a caveman" the poster says as they pull out a bent wooden spear with a tip made of dry poo poo

Powershell syntax looks awful every time I see it, yikes

OddObserver
Apr 3, 2009
PowerShell looks like they really wanted to show off finally having good tab completion.

FlapYoJacks
Feb 12, 2009
Powershell: More verbose == better.

Edit:
Bash, of all things, looks better than Powershell.
Hell, PERL looks better than Powershell.

Macichne Leainig
Jul 26, 2012

by VG
Someone was probably like "I like self documenting code" and now everyone is just like "no not like that"

Foxfire_
Nov 8, 2010

Powershell is lot better than unix shell script just because it doesn't have "everything is a string". It's wordy form is very wordy, but its tab completion works on flag names too, so it's not that bad to use interactively in practice.

Shell script being all strings is especially bad combined with POSIX filename horror. They are arbitrary byte sequences, not text. Nobody nonmalicious makes files with names that are things like zalgo text, nonnormalized/malformed UTF-8 sequences, or entirely various forms of whitespace, but those are all perfectly legal filenames in general

Soricidus
Oct 21, 2010
freedom-hating statist shill

OddObserver posted:

PowerShell looks like they really wanted to show off finally having good tab completion.

Powershell is awful for completion tho because they went with verb-noun, which is generally bad because it’s easier to guess the noun than the verb and you’re more likely to want to ask “what can I do to a Folder” than “what kinds of thing can I Get”

AWS cli is terrible for exactly the same reason

Macichne Leainig
Jul 26, 2012

by VG
I started on a new team and part of their setup process is just aliasing a bunch of AWS CLI commands because gently caress all that I guess

I'm not complaining, it's making my life easier

Macichne Leainig fucked around with this message at 02:24 on Apr 1, 2023

QuarkJets
Sep 8, 2008

AWS CLI sucks poo poo for sure, and boto is just a big pile of garbage made by idiots. It's seriously bad

Carbon dioxide
Oct 9, 2012

The AWS web console is worse.

Soricidus
Oct 21, 2010
freedom-hating statist shill

QuarkJets posted:

AWS CLI sucks poo poo for sure, and boto is just a big pile of garbage made by idiots. It's seriously bad

Boto haram

I would blow Dane Cook
Dec 26, 2008
goto haram

smackfu
Jun 7, 2004

FlapYoJacks posted:

The real coding horror is that awful syntax for a simple search. The Linux equivalent:

find /usr -name libcef.dll

Oh yes the intuitive Unix command line arguments.

Macichne Leainig
Jul 26, 2012

by VG

Carbon dioxide posted:

The AWS web console is worse.

We've been using Terraform at my company. It's quite nice to not have to worry about the useless web console either.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

QuarkJets
Sep 8, 2008

smackfu posted:

Oh yes the intuitive Unix command line arguments.

quote:

find /mnt/c/ -name libcef.dll

"find in this directory tree the name libcef.dll".

quote:

Get-ChildItem -Recurse -Path C:\ -Filter libcef.dll

"get child items recursively in this directory tree, filtering with libcef.dll, returning only the names of the files"

I think "find" is a more intuitive name for the command, it's what I'd start typing if I wanted to find something - it's a good name. I wouldn't start typing "Get-ChildItem" unless I already knew to use that command.

In the context of the "find" command's name it's obvious what the "name" argument does: you're finding things with a specific name. An argument named "-Filter" is a lot more ambiguous, it could be an inclusive name filter, an exclusive name filter, or it could be how you specify other filtering options. If I saw someone passing "filters.cfg" to the -Filter argument I might think that the command is going to load filter options from a config file.

Apparently Get-ChildItem has a "-Name" flag. I'd have guessed that it lets you specify the name you're looking for, but it actually just changes the formatting of the output, collapsing 10 lines of mostly whitespace into 1 line that's just the path to a file. This is all I'd want from a CLI that searches for and returns files, and it's what `find` does by default.

brap
Aug 23, 2004

Grimey Drawer
Powershell proves that it’s easy to be both verbose and confusing.

Now let’s talk about what happens when you want to return a value from a function in powershell and also log a message to the console.

Ranzear
Jul 25, 2013

Powershell is the lowest hanging fruit for this thread. It's still amazing how far they went out of their own way to not copy a single command from other CLIs, including loving Windows itself.

fritz
Jul 26, 2003

I can never remember how the filtering arguments for find work and I have to fuss with them every single time I want to do anything other than match on names.

Toshimo
Aug 23, 2012

He's outta line...

But he's right!

Ranzear posted:

Powershell is the lowest hanging fruit for this thread. It's still amazing how far they went out of their own way to not copy a single command from other CLIs, including loving Windows itself.

Most of the common unix and windows ones are builtin aliases so idk what you are crying about.

qsvui
Aug 23, 2003
some crazy thing
"Most" in this case does not include "find", which is definitely not an alias for the Unix version.

Ranzear
Jul 25, 2013

Toshimo posted:

Most of the common unix and windows ones are builtin aliases so idk what you are crying about.

"It's word-salad enough for us to pre-alias everything and normalize the practice" is not the glowing recommendation you think it is, and then it's only aliasing the basic command and still requires whatever technovomit single-dashed-only garbage they came up with for arguments.

It would be a huge help if any of this poo poo self-documented, but can you tell me off the cuff what Get-ChildItem -h does?

Falcon2001
Oct 10, 2004

Eat your hamburgers, Apollo.
Pillbug

Volguus posted:

Hey man, it's a chat program. Do you know how hard it is to write a chat program? Cut them some slack, that's a complicated piece of software.

I dunno if this is a defense of Teams or not, but it's not just a chat program, it does all sorts of dumb bullshit like handling files and sharepoint integrations/etc.

FlapYoJacks
Feb 12, 2009

smackfu posted:

Oh yes the intuitive Unix command line arguments.

Yes, most of them are pretty intuitive. Unlike powershell commands, -h is drat near always help as well.

Soricidus
Oct 21, 2010
freedom-hating statist shill

FlapYoJacks posted:

Yes, most of them are pretty intuitive. Unlike powershell commands, -h is drat near always help as well.
code:
$ find -h
find: illegal option -- -h

$ cd -h
cd: no such file or directory: -h

$ cc -h
clang: error: unknown argument: ‘-h’

$ ls -h
*exactly the same output as ls by itself*
and so on and so on

Adbot
ADBOT LOVES YOU

FlapYoJacks
Feb 12, 2009
Or --help
Or “man ${program_name}”

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply