uuencode host-file < host-file >encodedfile
Let's break this down into 4 parts:
uuencode is the name of the command to run. The shell searches the PATH environment variable ($PATH) and looks for an executable file named
uuencode in each directory in the PATH. In a standard install, this will be
/usr/bin/uuencode. The uuencode program takes a binary file and turns it into text in a special format so it can be sent over a network that can't handle non-ascii characters.
- The first
host-file is the command line argument to
uuencode command needs one argument so that it can put the name of the file in the encoded version. The first line of the encoded file will look something like this:
begin 644 host-file
< host-file is the shell using a file named
host-file as standard input (stdin) for the
uuencode process. So when
uuencode reads some bytes of input, instead of coming from your keyboard, they come from that file.
>encodefile is the shell using a file named
encodedfile as standard output (stdout). Thus, when
uuencode writes some output, instead of going to your screen, it goes to that file.
There is not really an order of execution, since only one command,
uuencode, is being executed. If you want technical details, read on.
Behind the scenes, the shell calls
fork(), then the child process opens the
host-file file for reading, opens the
encodedfile file for writing, and calls
exec(), which replaces the child process (a copy of the shell process) with the
uuencode process. The child process then becomes
uuencode, with the input file descriptor (a way the operating system keeps track of open files) set to that of
host-file and the output file descriptor set to that of