Friday 30 August 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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...