Lots of work on the saving and recalling of streams. Suppose you run this command, to
locate all files under your current directory, recursively.
shell script
ls -fr
This can take a while, and the output can be quite large, so you can put the
command in the background, as you would in bash: hit `ctrl-z` to suspend the
command, and then use the `bg`
command to have the command resume in the background.
But if you do this, then the output continues to go to the console. To fix this
problem, you can redirect the output to an environment variable:
shell script
ls -fr > allfiles
This puts the output of the `ls -fr` command in the environment variable `allfiles`. This
is not a file, it is an environment variable storing the contents of a stream. After you
put this command in the background, you can check on progress, e.g.
shell script
allfiles > tail -5
to see the last 5 `File`'s listed, or to count them:
shell script
allfiles | red count
If what you really want to do is to store the result in a file, you can do that too:
shell script
ls -fr | out -f /tmp/allfiles.txt
There are two differences. First, the environment variable is bound to your
marcel session, and disappears when you exit marcel. Second, the environment
variable stores actual `File` objects. If you store command output in a file,
then that file stores paths only, not `File` objects.