Complete as many of the the following shell scripts you can within the expected time of about 4 hours. :

  1. Any scripts we start in class.

  2. Version 2 of dirinfo.

  3. Write a shell script called triangle that prints a triangle to the screen.
  4. Create a script called makedos by copying the code.
  5. Create a script called undos by copying the code.
  6. Write a shell script called untab1 that will take a file name as an argument and convert the tabs to pipes. Have this script write the output to stdout. Use the tr command
  7. Write a shell script called untab2 that will take a file name as an argument and convert the tabs to pipes. Have this script write the output to stdout. Use the sed command.

The rest are optional and you can feel free to play more after turning in your assignment.

  1. Write a shell script called untab that will take multiple filenames and for each, convert the tabs to commas.

    To do this, write a function that converts one file and shows the output on the screen. Call the function replaceTabs. The file to convert should be an argument to the function. Have this script write its output to a new file in the current directory with the same name, but that ends with a .csv extension.

    After you have it working for a single file (using the function), updated it to work for all file arguments passed to the script.

    You may choose to use tr or sed, whichever you prefer.

    For more fun, have the script take the character to change the tab to as the first argument (and default to a ,).

  2. Write a script called uncapFile that will convert any capital letters in a file name to lower-case letters. Hint: try using the tr and mv commands. You will need some quoting too. Just try the tr command to start.

  3. Write a script called copyUSB that copies or moves files from your current directory to your USB drive.

  4. Write a script called squeezeSpaces that will process input from the keyboard (stdin), squeeze out all the spaces and replace them with a single pipe character, and show the results to the screen (stdout).

  5. Write a script called unzipAll that will unzip every .zip file in the current directory, and if the file is unzipped, move it into a backup directory.
  6. Explain in English what this command does: (Note that the first * has a space followed by a space then star):
  7. ls -ltS  | sed -e 's/  */|/g' | cut -d\| -f 5,9- | sed -e 's/|/: /' -e 's/|/ /g'