Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

4 Answers 4

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
share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

... 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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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