0

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?

Jim
  • 1

4 Answers4

1

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
mrc
  • 1,446
  • 11
  • 12
0

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.

BMDan
  • 7,129
  • 2
  • 22
  • 34
0

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.

Jim
  • 1
0

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

Jim
  • 1