OK, I read through the xargs documentation, pretty cool!

@vaporeon_ oh wow, posix xargs doesn’t suppurrt using null characters as a sepurrator

@aescling What would be the use-case for null characters as separators? Processing files that have a newline in the name?

@aescling Personally my opinion is that if you put a newline inside a filename, you deserve whatever troubles this causes you... It's just a wrong thing to do, even if it's technically allowed...

But I understand that not everyone may agree with that.

@vaporeon_ if POSIX allows newlines in filenames i’m either going to not assume they don’t have any, or make very clear that i am expecting a certain convention to be followed to not break my script lol

@vaporeon_ i have a feeling you would have some strong disagreements with the strictly typed functional programmer types if you got deep enough into learning languages like haskell. or especially a dependently typed language like idris or lean or something. you know, the kind of people who get really up their own ass about correctness

@vaporeon_ i have taken a lot of influence from my time learning such languages and i have noticed you do not seem to share that way of thinking lol

@aescling Aescling is Haskell programmer? Why did you never tell me?

I never got deeply into Haskell, but the superficial course that I took on it years ago was pretty fun

And also it introduced me to concepts like higher-order functions, which has been very useful for my understanding of programming in general even if I never got to seriously program Haskell...

@vaporeon_ anyway i learned functional programming through OCaml and learned Haskell later on my own, which imo is purrobably the better way to teach functional purrogramming, OCaml makes much better choices, pedagogically speaking, of when and how to cheat your away out of pure FP

@vaporeon_ @aescling This has happened before by accident as a result of trying to operate on text files/scripts that were saved in windows notepad.

@aescling @vaporeon_ One thing we did was a script that would take every line in a text file and make an empty file named for it
Say the document says:
Super Mario Bros
Luigi's Mansion
Sonic the Hedgehog 2

After the last character of every line it would have a newline characters because bash assumes Linux line endings instead of windows

So you get a file named Super Mario Bros[CR].

@onfy @aescling Hmmm.... cat your-file-list | tr -d '\r' | xargs touch?
(Without testing, give me a few seconds to test this)

@vaporeon_ @aescling I don't remember just what I did. I guess I should've asked you instead of whatever horrible thing it was.

Though it did work in the end if you ignore that it broke FAT.

@onfy @aescling I only learned how to use xargs today, at most a few hours ago, so don't assume I am competent when I am not...

@onfy @aescling You, too, can learn xargs!

In any case, you're still learning Linux right? I think it'd be unfair to call someone incompetent who is still learning. Do you want me to look over your script and review it?

It's just that I have been doing this for so many years that I really ought to know it... And also I specifically want to be good at computers, just like some of y'all want to be good at melee fighting games or whatever, and so it is frustrating when despite my best efforts, I am bad at computers...

@vaporeon_ @onfy

I think it'd be unfair to call someone incompetent who is still learning.

vaporeon… please take your own advice…

@aescling @onfy I think it'd be wrong to call me "someone who is still learning" after all these years, I really ought to know Linux by now, I'm really not new to it at all

@vaporeon_ @aescling we're all learning, always. give up on learning is like giving up on yourself

@onfy @aescling Where would I even plant a tree? I do not own any land

Show newer

@aescling @vaporeon_ i have the weird flavour of autism where i understand and use metaphors :blobawkward:

Show newer
Show newer

@vaporeon_ @aescling i'll see if i still have it

not sure what i want to be good at...

@onfy @aescling Never mind, this doesn't work because apparently xargs treats quotation marks (like the one in Luigi's Mansion) as special characters... So instead, I have to do:

cat games-list | tr -d '\r' | tr '\n' '\0' | xargs -0 touch

@aescling @onfy Yeah :(
Do any of the smart people on here ( @alas ) know how you'd get around this problem using only POSIX-standard tools?

@aescling @onfy Good news! I went and checked POSIX 2024 instead of POSIX 2004, and that actually specifies the -0 option, too: pubs.opengroup.org/onlinepubs/

@aescling @onfy But it really got added only in the latest verson of POSIX, I tried versions from 2008, 2013, 2016, and 2018, and they don't have it there yet

@aescling @vaporeon_ The result was a hideous "it works on my machine and breaks horribly on theirs" bug, since my text files have Unix endings.

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.