Question regarding quotation syntax

Hey guys, my first post on UNIX Forums(much overdue IMO)!

I've got this bit of code that doesn't seem to be working correctly for an Android app I'm working on:

"screen -S gmod1 -p 0 -X stuff " & "" & command.text & "`echo -ne '\015'`"""

Basically it types command.text(variable determined in Android app) into a screen session and hits ENTER. It works perfectly fine if its only one word, but if I want to do two words, I must manually put them in quotations in the actual app. Is there any way for me to wrap command.text in quotations programmatically?

Just out of curiosity I tried adding another

& "" &

around command.text but it didn't change anything.

Any help would be greatly appreciated as I'm almost done the app and don't want to get stuck on a syntax issue.

Thanks! :b:

Did you try to use escaped quotes (\")?

like this?

"screen -S gmod1 -p 0 -X stuff " & "" & \"command.text\" & "" & "`echo -ne '\015'`"""

I should also mention, the UNIX part of this is instead of typing the text and hitting enter its saying "-X: stuff: invalid option 'say' " (because in this case command.text is "say hi")

Escape quotes aren't supported in this language. I'm writing to their forums as well.

This is how I send commands to a screen session with -X stuff :

screen -p 0 -S gmod1 -X stuff "$(printf "%s\r" "say SERVER BACKUP STARTING. Please logoff ASAP...")"

I don't know how this would be defined in your app, perhaps:

"screen -p 0 -S gmod1 -X stuff "$(printf "%s\r" "command.text")""

Or perhaps this:

"screen -p 0 -S gmod1 -X stuff  'command.text'" & "`echo -ne '\015'`"

Other forum answered finally! The proper syntax was

command.text = """" & command.text & """".

Now I'm stuck on trying to print the output from the screen session, any pointers?