CS 2204 Lab 9

Your name here (please print):

Your student ID number here:

  1. (3 points) Figure out how to use the tr command (try man tr). Create a file called input.txt (using vi, gedit or whatever you like) and put in a sentence or two. Then, write a command (using tr) that replaces all the letter 'e's in that file with an underscore ('_'). The converted text need not be saved, just printed to the screen. Write the command below.
  2. (2 points) Write a bash script that prints out all its arguments, one per line.
  3. (2 points) Write a bash script that takes exactly 1 argument and does the same conversion ('e' to '_') as in #1 on the text inside that file, printing the result on the screen. Make sure your script works even if that single argument has a space in it (like "my file.txt")!
  4. (3 points) Write a bash script that takes filenames as arguments (at least one) and converts all their 'e's to underscores ('_'), printing the results on the screen. Make sure you can handle filenames with spaces in it.