What is the easiest way to quote bash command arguments that contain single quotes and double quotes without variable interpolation?
In Ruby you can quote strings using %{}, %[] etc. In that case single quotes and double quotes will be treated as characters.
My question was not really complete here is further explanation:
The reason I am asking that is because I often run ruby and perl code at the command line. Since those languages are using extensively single quotes and double quotes and global variables like $1 $_ etc. I get conflicts with bash.
example:
ls -lat | ruby -p -e '$_ =~ /(\S+)\s+(\S+)\s+(\S+)/; $_ = "'\''" + ($3 || "") + "'\''" + "\n"'
I was looking for something similar to the % quoting in ruby:
ls -lat | ruby -p -e %{$_ =~ /(\S+)\s+(\S+)\s+(\S+)/; $_ = "'" + ($3 || "") + "'" + "\n"}