sup
i'm using "read" to get a directory path into an env variable.
shit works well when the path doesn't contain an escape command for whitespaces like here:
/home/durp/pics/test_folder/
this here makes problems:
/home/durp/pics/test\ folder/
"read" simply ignores the escape command, but i need it. how do i circumvent that?
Use Perl to recursively replace all the spaces in your directory names with underscores or dashes (as suits your fetishes).
Then your script will work *and* you won't have spaces in your directory names (that's big fail right there, kid, big fail)
>>8
Are you by any chance the same person who suggested a while back, that names should be allowed to have spaces and that they should be delimited by two spaces?
>>13 Then why did you post it?
I was typing fast OK!
Name:
Anonymous2009-09-08 14:23
>>1 read treats a backslash as a escape character. There's an option for read which makes the character act as part of the line but I don't want to deny you the learning experience of Reading The Fucking Manual.
>>2
Bullshit. White-spaces in file names are a not an issue. Opinions held as truths are. One man good practice is another's shitty design.
Just because it's a legal char. does not mean its The Right Way to do it, or even an advisable or smart way to do it either. Since it obviously breaks shit why do it, deeeeeeeeerp
Name:
Anonymous2009-09-08 15:30
Don't forget to make sure your script handles filenames with newlines in them.
Name:
Anonymous2009-09-08 15:42
>>21
Not this is just plain rude, sir! Newlines are escape sequences, not characters like spaces.
Name:
Anonymous2009-09-08 15:55
>>20
The smart way would be to call read a single option and it will support Wapanese file names. It's not really an issue. If white space is an issue then you either have to migrate from DOS or read the fucking manual.
shit works now, but now i have another problem:
the path with the escaped whitespaces is in my $var
if i do ls $var it fails
if i do ls /home/durp/pics/test folder/ it works, but there's actually no difference between the $var and /home/durp/pics/test folder/
so what the fuck is wrong now?
>>37
everyone who isn't a faggot uses zsh. but they still have /bin/sh.
just like everyone uses vi, but still has ed.
only faggots have things like bash and vim installed.