bash Scripts
Lynn David Newton
plug-discuss@lists.plug.phoenix.az.us
Sat, 25 May 2002 16:51:25 -0700
>> Run hexdump on the script and post the results. The hexdump should look
>> *exactly* like this:
>> $ hexdump -xc test
>> 0000000 2123 622f 6e69 622f 7361 0a68 6f66 2072
>> 0000000 # ! / b i n / b a s h \n f o r
William> Is there an easy way to make traditional
William> CP/M style hex dumps from a file? For
William> example the above would be:
William> 0000:0000 23 21 2F 62 69 6E 2F 62 : 61 73 68 0A 66 6F 72 20 #!/bin/bash.for
William> (which will probably get wrapped in this
William> email). Even better would be something like
William> CP/M's DFX (Disk Fix) or Norton Utilities of
William> old which would permit hex editing through a
William> "curses" style interface. I miss those
William> incredibly handy low-level tools!
William> Does such a thing exist for linux?
Get thee to XEmacs! There is a hexl-mode hex editor
package I've been using for many years.
At this exact moment, there is something broken about
the package -- a legitimate emacs lisp bug which I
reported, and was told is a known bug, and which will
be fixed in the next release. However, hexl-mode works
with an external C program called hexl, which happens
to work standalone. Just for kicks I tried it:
$ cat > deleteme
#!/bin/bash
for i in blah
C-d
$ /usr/local/lib/xemacs-21.4.0/i686-pc-linux/hexl deleteme
00000000: 2321 2f62 696e 2f62 6173 680a 666f 7220 #!/bin/bash.for
00000010: 6920 696e 2062 6c61 680a i in blah.
Normally, in XEmacs you'd run M-x hexl-find-file and it
would bring the file up in a display like that, and you
can edit the file by typing in the right column.
I don't believe the package is included with GNU Emacs.
--
Lynn David Newton
Phoenix, AZ