Shells II



next up previous contents
Next: Commands II Up: Solutions to Exercises Previous: Electronic Mail

Shells II

  1. I'm not interested in the actual output. All I want to know is the number of lines the program outputs.

    This could be done using the wc (word count) command, with the -l flag (that flag counts the number of lines in a file).

    display.dates | wc -l

    As display.dates is processed, its output is piped to wc -l, which displays how many lines it read.

  2. I know that running that job interactively will take all the time I have left. So, I want to run it in the background. But I can't log off when I have a job running in the background...

    Use the batch command: it will send the job to the batch queue, and the results will be sent by mail. Meanwhile, I can work on that letter I have to write.

  3. In the C shell, one recalls the last command previously executed by issuing
    !!

    The last command used beginning with la is recalled using

    !la

    In the last command 54 can be changed to 45 by issuing

    ^ 54^ 45^
    (NOTE: the command will immediately be executed).

    I can find out which aliases I am now using by typing

    alias
  4. If the shell I am presently using can use the alias and the history features, I am certainly NOT in the Bourne shell, because those features are not supported in that shell.

    In many instances

    echo $shell
    will reveal which shell you are using.



Super-User
Fri Feb 17 15:55:40 EST 1995