Friday, August 30, 2019

linux - Print single quotes in shell script using option -c

This may sound novice but I tried everything to get this to work.
I want to print a word with single quotes : 'John' in shell script. I cant replace /bin/bash -l -c as this part of code is run by Java and I have to pass the shell command as a string. I tried with echo -e option as well.




/bin/bash -l -c 'echo "'John'"'


The output I want is:



'John'


I tried escaping the single quotes but nothing helped so far. Any ideas?

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...