UNIX = abused wife syndrome

>UNIX
pic related

Attached: unix meme.jpg (1040x690, 61K)

Other urls found in this thread:

dwheeler.com/essays/fixing-unix-linux-filenames.html
twitter.com/SFWRedditGifs

What the fuck? Why would you put spaces in your file name? That's absolutely fucking retarded.

mkdir "directory with spaces"
or
mkdir directory\ with\ spaces

i-i'm sorry, i don't know what i was thinking... i'll try to do better next time, just please don't break any more of my scripts...

Attached: lawyer86-600x454.jpg (600x454, 36K)

/thread

what kind of a CUNT posts shit liek this
Fucks sakes do I have to tell you EVERY TIME?
Getting real sick of your shit. One of these days...

Only program I've encountered within the last decade that had a problem with spaces in filenames is a proprietary Windows one written in Java.

This

you must not be a unix user

We're being raided. These shit threads have been going on all week. Just don't feed it anymore than you already have.

By who, suckless?

what scripts would break by this?

honestly, this is day 1 shit.

any bash script that uses a loop with the default delimiter (space) will break on a filename that contains a space
eg for i in $(ls); do ... without setting IFS=$'\n''
but then that solution (defining another delimiter) will break on filenames with newlines
basically unix shells are retarded and dont know how to do trivial things like escaping

No shit, he just said that he uses proprietary Windows programs :^)

Jewish aliens commanded by Donald Trump

Attached: 1518143180015.jpg (600x655, 36K)

That ain't the script buddy, that u.

LOL

That's not a meme you dip. It's an image macro you made a few minutes ago. Get hundreds of people to spam it again and again and you'll have a meme. Fucking memelets will never learn

when PHP programmers (that they are apparently smarter than you says a lot abotu you btw) realized that you could change the structure of a HTML page by interpolating text with HTML tags into it, they thought "oh, that sucks, ill write a function that escapes text into a representation that can be safely put in an HTML page without changing the meaning of it, no matter what the string is"
this is one way people protect against XSS (HTML escaping bugs)
when they realized you could change the meaning of SQL queries in a similar way, they did a similar thing - text you wanted to interpolate into a SQL query was passed through a function that made sure tyhat, no matter what the text was, you could safely put into your query without any possibility of the meaning of it being changed by the inpuit you gave it, as long as you passed it through that function
this is one way people protect against SQL injections
when shell programs are confronted with the problem of certain classes of filenames changing the meaning of their scripts, causing them to crash (at best) or do something malicious (at worse), they "solve" it by just shitposting on various forums and mailing lists telling people to just simply not use filenames with funny characters in them because they are literally more retarded than the dumbest of PHP programmers and so the actual nature of the problem (that it is impossible to do escaping correctly in a shell script, it will always break on *something*) is a complete mystery to them and the actual solution (being able to do proper escaping so scripts work for *every* filename, not just the ones you like) does not even occur to them and when someone else points it out they cannot accept it
tl;dr you are and idiot

Attached: 1513303300970.jpg (278x242, 11K)

>$(ls)
>citing php
Someone's an idiot.

>windows

Attached: 1522039456170.jpg (889x1024, 128K)

i literally do not understand the meaning of this post
are you implying that i thought $(ls) is PHP syntax?
whatever you think i meant, the point is that PHP programmers, confronted with escaping problems in HTML and SQL, solved them by letting you actually escape strings so that *every input* can be safely put into an HTML document/SQL query, while shell programmers are confronted with the *exact same problem* and yet just bitch about how people use filenames they dont like
i brought up PHP because it is a shitty language in every respect and yet they actually made the step of realizing what the problem was while shell programmers write idiotic posts like instead of even admitting that the problem exists
PHP programmers are literally smarter than shell scripters

No I am saying you are doing stupid things and blaming your incompetence on the language. They were two different points. And none is bitching about file names with spaces except for trolls.it literally isn't a problem if you take the effort to learn the language instead of doing stupid shit like $(ls). You say escaping is "solved" in php but I bet morons like you can still shoot themselves in the foot.

where is the escaping function that will transform all valid filenames into a representation that can be safely used in any part of a bash script and by every unix program that deals with file paths?

find . -print0
Lol

>Used by Apple, Sony, and Nintendo
>*BSD's can't even support modern hardware that Mac/Ps4/Switch uses.

Now that's what I call a cucked license...

unix should have been replaced by something a long time ago. But, like x86, compatibility is the progress trap of technology.

This is exactly why you never use ls to iterate over files. You should be using the built in pattern matching. every time you do $(ls) instead of ( * ) a kitten dies. also it looks like an asshole so that's a plus.

bash and most gnu coreutils have solutions for things like this. namely using nul bytes as filename/path delimiters since virtually linux fs does not allow nul bytes.

this. there is no reason we should be using this shit anymore.

shells built around passing untyped garbage everywhere that has to be transformed
hierarchical process spawning and all the pains of env management because of it.
literally no good good userspace ways to safely pass permissions over IPC.
signaling is probably one of the worst IPC mechanisms ever created.

What would you rather have it replaced with? Be descriptive. I keep seeing this sentiment, but never an actual idea.

seL4

Plan 9 or Inferno

Actually, that sounds like a good idea. Their formal verification stuff is definitely something we need to see more of, and I've been hoping for a microkernel design.
That said, seL4 is just a kernel. There is Genode OS, but from what little I can tell that's also going to be fairly unix-like.

>PHP
>function that escapes
>mysql_escape_string
>mysql_real_escape_string
>mysqli_escape_string
>PDO::quote
Don't ever bring PHP up as an example of something good ever again. Normal languages just use parameterization instead of escapes like a fucking caveman (added to PHP years too late and most people still don't use them).

i never said it was good, and i dont think its good, and i said it wasnt good in but it is better than the bash solution of either "dont use filenames with weird characters" or "just dont use basic shell features like loops and wildcard expansion and instead use find -print0"

this does not solve a) the problem of filenames printing control characters to the terminal, and b) like i just said, it means you cant use half of the features of your shell eg:

$ touch -- \-rf
$ rm *
$ ls
-rf
$ find . -print0 | xargs -r0 rm -rf
rm: refusing to remove '.' or '..' directory: skipping '.'
$ ls
$

so, no *, you cant set IFS=$'\0' and loop through it, etc
also it is not standard, the supprt for this has to be written into the program you use (it doesnt exist in the shell, it exists in find - so if you want to use another program to traverse your filesystem, it must also support the -0 option)

from dwheeler.com/essays/fixing-unix-linux-filenames.html (who is wrong although for understandable reasons) on find -print0/args -r0 and friends:
"We can now loop through all the filenames, and retain any variable values we set, but this construct is hideously ugly and non-portable. Also, this approach means we can’t read the original standard input, which in many programs would be a problem. You can work around that by using other file descriptors, but that causes even more complications, leading to hideous results. Is there any wonder nobody actually does this correctly?!?"

this is worse than PHP, at least their solution is an actual function (you know, the most basic and fundamental unit of computer programming)

gcc yourpost.c -o lol

you're a fucking all-out retard m8

I have spaces in my filenames all the time. I just escape them since I'm not retarded

While the rf is bad, the -i file is good to have in some directories.
It avoid a lot of heartache.
The only situations where I run into space in path name issues is with proprietary installers and with ROS

if it's so retarded why does unix allow it? perhaps because unix is retarded?

KEK

>for i in $(ls)

The fuck are you talking about? Just rm -- * nigga

minecraft?

mkdir directory_without_spaces

What's wrong making filename with spaces? Only fucking brainlet (brogrammer) would be upset by that.

r u retard?

ls isn't made to be script-friendly in ANY way.

Attached: out.png (168x78, 8K)

>doesn't know what meme is
>OP is a webdev
>OP is a normie scum
no wonder

>stockholme
illiterate retard

by three or four dildos making threads like this one all day where they bitch about something in a nonspecific way so that the only possible outcome is those for and those against the subject throw shit at one another like the special needs classroom. Hey Jow Forums, this software with a specific feature set for a specific purpose sucks because the feature set is not useful for the thing i'm applying it to. Every one please argue pointlessly now. And the "hey technology board, why learn about technology when x product just does it out of the box? Lelelel" or "hey technology board, please recommend me the best x. I want to hear all your subjective opinions on x" and the lovely "x is the greatest of all time, what kind of idiot uses z that performs an identical function?!?!" like i know where i am, but damn if it doesnt take me hours to find a worthwhile thread where some actual info is presented.

To follow up, lets look at the top 5 threads right now. 1#: whats the best desktop environment for no particular situation? please argue amongst yourselves 2#: windows user here, mac is so shitty lololol 3#: i'm trying to code in linux, all ide's and text editors in existance are shit, prove me wrong lololol 4#: debian or ubuntu for no particular application, please argue here 5#: name a bigger cuck than pic related, pro tip you can't please try to prove me wrong losers.

nice wallpost
also, isn't that the usual quality on /gee/ - consumer whoretronics?

this confirms you are retarded and don't know what you are talking about.

it's common knowledge that you always use globs to iterate over the contents of a directory, i.e.
for f in *; do
echo "$f"
done


If you don't want the glob to default to itself when nothing matches, use shopt -s nullglob

Jow Forums has gotten significantly worse during my time here. I only check the catalog every few days at this point.

The post quality here went to shit when Jow Forums trolled the Lispers away.

spaces in filenames are okay
real dumb shit is allowing newlines (meaning that the only reasonable way to store a list of filenames is via \0 termination even though the Unix Way is extremely fond of working with data in line-oriented formats)

spaces suck just because word splitting is a default for retarded legacy reasons in the shell (when was the last time you deliberately didn't put a shell variable in quotes, emphasis on deliberately)

>rm $i
>not rm "$i"
no seriously, this breaks on spaces otherwise

the absolute state of unix

Attached: dumb assholes this box.jpg (713x670, 224K)

I do it for aesthetic.

mkdir directoryWithoutSpaces

i mean, why the fuck would you want spaces in your filename? they are only a source of confusion. use underscores or nothing at all

>doesn't know what variable expansion is
>DURR loonix is bad

Attached: amerimutt.jpg (673x789, 140K)

> >rm $i
> >not rm "$i"

>Not rm *
That's what I wanted to note.

> Unix here
> Unix there
Fuck you, Unix was a shitty proprietary system, thank god nobody uses it anymore.

I have honestly never written a shell script that has any problem with filenames that contain spaces. All Bash tutorials show you how to use quotation marks. All you have to do is keep using them. They work with all shell syntax.

They're only a source of confusion if you're fucking brain dead. I use spaces to separate words in my filenames because I use spaces to separate words in my sentences. If you think you have to use something else to avoid imaginary "computer problems," you're either wrong, or you really do write all these bad non-space-safe shell scripts everyone ITT is talking about.

This. If you ask someone about what they think is the "problem character" in shell scripts and they say it's space, you know they're actually a Windows user and they were forced to use shell once in university or something. For someone who actually uses Unix/Linux and shell, they know newline is the real problem character.

>Unix/Linux
What is this?

It's a list of two different families of operating systems, both of which tend to have filesystems that allow the newline character in filenames, and both of which come with tools (like find) that don't handle filenames with newline characters very well.

not in superior zsh which doesn't have legacy sh wordsplit bullshit on by default.

bashlets eternally btfo'd

>and both of which come with tools (like find) that don't handle filenames with newline characters very well.

this is why you use GNU + Linux bro.

spaces can be a problem in other tools though, like make where all the macros and shit expect strings with spaces to effectively be an array of values.

How is that superior? That's really inconsistent behavior, definitely violates the rule of least surprise. That behavior would only be useful if you didn't understand how variable expansion works.

Just put "" those bad boys
And yes putting spaces in paths is retarded

Attached: flat,800x800,075,f.u1.jpg (786x800, 152K)

It's not hard.
I test all my scripts with spaces in paths.

word splitting expanded variables as default absolutely violates least surprise, expecting it to split is learned behavior

depends
you generally loop over it if you expect to ever hit the max argument count (or if your target program, so something other than rm only takes one file argument)

>I have honestly never written a shell script that has any problem with filenames that contain spaces

You haven't written any scripts at all then

who cares about yanix, loonix its much better.

Holy shit you're dumb if you actually did scripts with spaces in filenames.

Enjoy your POSIX non-compliance.

similar shit has always been going on here, but yeah i'd say it's gotten worse especially with the shit slinging along the lines of "lol everything i dont like is reddit", shills, and Jow Forums threads

No, it is not. It's only surprising if you don't know how variable expansion works.

>POSIX non-compliance

you say this like it's a bad thing tardass.

it doesn't fucking work, period. it's a 5 step retard cycle that only confuses and confounds the mind.

shit like {$x..$y} doesn't work in bash precisely because of this retardation. same with ~"$some_username" and many more.

how the fuck is is inconsistent? the only inconsistent part of this rule is command substitution which does split if unquoted.

who gives a shit about posix?

here's a thought experiment:

* write software carefully trying to stick to posix spec.
* write software by referencing the man pages of linux and bsd, run and test it on linux and openbsd

which software do you think is going to work on both systems?

if you expect the posix one to be "portable" without testing it on your target systems you dont live in the real world.

A way to avoid saying "GNU".

>real world
Customers don't care about OpenBSD.
Write it for GNU/Linux.

you completely ignoring the point i was making lol

what's wrong with gnu?

Some Unix people think it's "harmful" or whatever, despite it working perfectly fine, and often better than their shite

>despite it working perfectly fine
umm.... about that...

Why sticking to POSIX won't be portable on GNU/Linux or GNU/OpenBSD?

They're slightly likely to care about freebsd, integrity, or qnx.

because theory and practice differ

Please, provide a concrete example.

the big issue with GNU among people who follow The Unix Way is that GNU extensions violate the "do one thing well" rule, and the extra shit should be split into other utilities instead of aggregating together in places where they "shouldn't" be
in the majority of cases, I don't agree, but GNU tools are universally fatter and more complicated, whether it be freaky shit like GNU's cat (long and complicated, does some fancy speed optimization -- although it's justified because cat is used extensively in places where it shouldn't, so it should be as little of a bottleneck as possible) or things like GNU ls and it's several dozen options

but really, I use a ton of that extra shit because it's useful, and I'm annoyed as shit in a more traditionally "unixy" environment even though I'm a fan of other ideals in the Unix Way

"Text is the universal interface"
>can't parse ls

unix is retarded

When you realize that the output of ls depends on many differt things like your language and whatnot, even a retard would use at least the find program.
A non retard ofc would just use *.

Install REISERFS to take it to the power of 1337.