Unix and shell-programming 2001, demo 2 Unix and shell-programming 2001, demo 2 (31 Jan 2001)

Pay attention to special cases and error situations!

  1. Write a function that

    1. prints its arguments one per line, numbered and in single quotes (e.g., 1: 'ass');
    2. prints its arguments vertically one character per line

  2. Write a function that can be used to check if a string contains special characters
    | & ; < > ( ) $ ` \ " ' * ? [ # ~ = %
    
    or space, tab or newline so that

    1. no output but return status 1 if at least one was found, 0 otherwise
    2. print a list of special characters found

  3. Write an sh script that searches for scripts that begin with #! in a given directory, and reports which shell (or whatever) would execute them.

  4. Write an sh script that reads comma-separated integers from a file and computes and prints their sum separately for each row and then total for all.

  5. Write sh script addhandle that reads people's names from one file (last name last) and nicknames from another (assume they're in same order) and prints them together like this:
    Kauko "Kake" Virtanen
    i.e., adds nickname in quotes between first and last name.

  6. Write sh script namesplit that reads files like the previous script's output and splits them in two so that one file has first and last names and the other nicknames. I.e., reverse of the above.


File translated from TEX by TTH, version 1.98.
On 25 Jan 2001, 13:38.