I have a script which absolutely 100% _has_ to be done in this ridiculous fashion:

echo $'\150\151\073\145\143\150\157' $'\171\141\171'
(unencoded: echo hi;echo yay)

The problem is that everything after the echo is assumed to be an argument, so the semi-colon and the second echo command are output as well. Is there any way to get the shell to actually parse the semi-colon and break up the two commands?

link|improve this question
feedback

4 Answers

you could try with a NULL character just before the '\073':

echo $'\150\151\0\073\145\143\150\157' $'\171\141\171

this way the shell will parse the ';'

the output will be:

hi yay

and not

hi
yay
link|improve this answer
feedback

eval? Backticks? Pressing enter between each line? sh -c? $()? Something else entirely? Without knowing why you have to do it in this ass-backwards way, we can't really offer many alternatives, since we don't know what you can use.

link|improve this answer
feedback

It's not letting me reply to comments since I'm not logged in.

Anyhow, everything must be input on one line with octal characters. No `, no $(, no enters, and no eval. It's octal or nothing.

link|improve this answer
feedback

... nor can I edit previous messages.

I've tried the null bytes, but it just terminates that string -- not the echo command. Your example would not result in two separate commands but a single command. It's the two commands I'm after.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.