Quote:
Originally Posted by
linuxmember
hi corona, sorry for asking this, but could you explain your code. my scripting skills are limited.
base64 -d > /tmp/$$ <<"EOF" This seems to decode some data and add it to a file and appends and EOF at the end.
Right. <<EOF is a 'here document', allowing you to put a document inside a shell script instead of including it as an external file.
I got the contents from
base64 < filename, picking /etc/mime.types as a big harmless file. I didn't post it in its entirety to save space.
Quote:
1. Which data does it decode and what does $$ mean?
Nothing important, I just fed it part of /etc/mime.types. The content isn't important, you just wanted a lot of data, right? If you change the data, you have to change the checksum of course...
$$ is the shell's PID, so more or less a convenient "unique" number. If you used the same name all the time you might bump into a pre-existing file or some such when things went wrong.
Quote:
set -- $(md5sum /tmp/$$)
2. what does "set --" do to the checksum calculated?
md5sum prints "checksum filename".
set -- a b sets $1 to a, $2 to b. So this sets $1 to the checksum, and $2 to the bit we don't want.
Quote:
if ! [ "$1" = "0e..." ]
3. $1 is ? (first argument for?)
$1 is what set it to with
set --
Quote:
With my limited scripting skills it is difficult for me to understand in which step a RS232 transfer is taking place
The intent was for you to feed that script into the serial port, assuming the serial port has a shell running in it.
If it doesn't, you might be able to kludge it with
bash < /dev/ttyS0 or what have you.