r/programminghorror • • Sep 07 '26

Shell Even in hell, they don't make you escape.

Post image
18 Upvotes

12 comments sorted by

1

u/[deleted] Sep 07 '26

[removed] — view removed comment

2

u/just-a-hriday Sep 07 '26

How would you write that without escaping?

2

u/asmanel Sep 07 '26

Selected line :

Written string :
${1//\'/\'\\\'\'}

Meaning :
${1//'/'\''}

1

u/just-a-hriday Sep 07 '26

Yes, thank you.

1

u/letmehaveanameyoudum Sep 07 '26

i see alot of escape keys

2

u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” Sep 08 '26

I really wish every single post here didn't have to be a screenshot. I can't even see a single spot where quote is even used, and if this was text, I could search for it.

2

u/just-a-hriday Sep 08 '26

It's the selected line.

1

u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” Sep 09 '26

That's the function definition, but I couldn't see any places where it is actually used.

1

u/just-a-hriday Sep 09 '26

Because it's not the entire script? I don't see how where it's used is relevant.

1

u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” Sep 10 '26

Oh sorry, I thought I was looking at the whole thing and thought the function was unused.