Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Condor323324y@netikras it particularly becomes an issue when you try to parse stuff over SSH. With that you need 2 layers of escaping, or as many SSH consecutive connections as you need to make. Another issue is that the remote server might be running a different shell.
-
@Condor so then escape the quotes :)
"\"this is some string\""
Or even better -- wrap the top-level string in single quotes and get rid of those escapes:
'"this is some string"'
This way top-level command will take the doubly-quoted string as an argument (incl the double quotes) and send it to the remote machine.
Escaping all the whitespaces feels... tedious :) -
Condor323324y@netikras could work yeah, but the problem with single quotes is that you can't use variables in them.. and escaped double quotes would work too. But of course in the rant I kinda overexaggerated :P
-
@Condor I see :)
Also, there's a 3rd option I have used a few times -- store that string in a variable generated with heredocs. A less portable, but highly flexible approach. This way you can have multiline text, variables and whatnot in the string. And pass it over to the command with a simple "${my_variable}" ;)
Related Rants
-
justamuslimguy20All the stupid date functions where the days range from 1 to 31 but the months range from 0 to 11
-
sudo-woodo16Whatever the fuck Python's ternary operator syntax is supposed to be.
-
Root18Most hated language features? PL/SQL: • it exists XSLT: • it also exists PHP: • it still exists. VB:...
'"I\ absolutely\ love\ bash\n"'
And somehow it will still be fucked up.
rant
wk229