Assembly

Derek Martin dmartin at ne.arris-i.com
Sat Jan 29 12:57:09 EST 2000


On Sat, 29 Jan 2000, Scott Lanning wrote:

> the functions yourself. As an example, I created a version of
> the 'cat' utitility which is 444 bytes long vs. 10492 bytes
> of the one with Red Hat 6.1 (it only does one file specified
> on the command line, though, not accept stdin or multiple files).

This might be a good time to point out that the actual purpose of the cat
command is not to display a file, but to conCATenate multiple files
together.  The fact that its output is to stdout by default and that it
only requires one argument have made it a convenient way to display small
files.  Displaying larger files is more appropriately done with a paging
command such as `less' (which I usually ln more to), `more', and the
ancient and venerable `pg' command.

Incdentally, if you are having shared library problems, but you have a
statically linked shell on the system, you should be able to display the
contents of a file with something like this:

  $ while read LINE; do
  > echo $LINE
  > done < filename

where filename is the file you want to see.  Note that this may not work
with older versions of the shell, and I don't know if it works with C
shell since I never use it. [There is a famous document about why not to
program in the C shell; I thought I had the link, but I can't find it.
Someone?] I suspect it won't since C shell is rarely statically linked,
AFAIK. A similar trick to get a primitive directory listing:

  echo *

Thus ends another episode of stupid Unix tricks... :)


Note that BASH is typically NOT statically linked.  On RedHat, if you want
a statically linked shell to be installed, you need to install the sash
RPM (which gives you /sbin/sash).

-- 
"Quis custodiet ipsos custodes?"    "Who watches the watchmen?" 
-Juvenal, Satires, VI, 347 

Derek D. Martin      |  Senior UNIX Systems/Network Administrator
Arris Interactive    |  A Nortel Company
derekm at mediaone.net  |  dmartin at ne.arris-i.com
-------------------------------------------------

-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).



More information about the Discuss mailing list