Hi KMtronic,
Hmm, as far as I know that's not possible with "
echo". The echo command is not a stand alone command but is build into the shell (the command interpreter). I don't know all shells - far from it - so I could easily be mistaken. In the good old days the only shells around were "
sh" and "
csh". In those two only the octal notation was possible (because the backslash notation for character escape sequenses was derived directly from the ANSI C definition, I guess and that definition knew of neither decimal nor hexadecimal notation). When "
ksh" and "
bash" came around their echo command had the hexadecimal "
\x" notation added - probably because it was also added to the "
printf" command.
I don't know much about MAC OS - actually i dont even know which shell is the default (a "
basename $SHELL" will reveal that :o); but i would guess it does not support decimal notation either. If it is indeed possible, it should be explained in the system - try a "
man bash" or whatever shell you use on your system and seach for "
echo" (just type "
/echo<return>" when the manpage is shown (find next is "
n")).
On my system (ubuntu, actually) even printf does not support a decimal notation for character backslach escape sequences - at least not directly. It would be possible to do something like this however:
Code:
let var=255
printf \\$(($var/64*100+$var%64/8*10+$var%8))
- to print an ASCII character based on it's decimal value; but it's a bit like crossing the stream in order to get a drink of water....
It would very simple to make a script or function to do this translation as well (or compile a small c program that did it if need be).
Anyway, I kind of like the hexnotation - it looks short and neat in my opinion. Why would something like "
\d255" be better or easier to understand than "
\xFF"? I do realize "
\x0A" is less intuitive as a reference to the tenth relay than for instance "
\d010"; but it's probably only being used when the program controlling the device is being developed - and not by the end user...
Np help - I know. Sorry.
Cheers
Claus