User Tools

Site Tools


Assignment 5

Due Sept 11

Question 1

Commands versus programs.

On summit, what is the path of these commands?:

  • cp
  • install-info

Question 2

Execution. Suppose we have a script called,

  • Show me a command to make, executable.
  • If the executable script is in your current directory, but not in your PATH, show me a command to run it.

Question 3


You execute the statement:

$ echo "Are we having $noun yet?"
Are we having fun yet?

Write a statement to assign the value “fun” to the variable noun.

:!: Hint: test your code

Question 4

The tr command and rev commands.

Find arguments to tr such that, if given an RNA OR DNA sequence, it outputs the reverse complementary DNA sequence:


But it must still work on DNA: e.g.: translate 'TTTCCC' into 'GGGAAA'.

:!: Hint: test your code

Question 5

Scripting with arguments.

Write a script that labels arguments 1 - 3, but gives an error message if there is more than three.

:!: Hint: I will literally copy your code into the terminal and run it:

$ bash apples oranges plums
Argument 1 is apples
Argument 2 is oranges
Argument 3 is plums

But print an error if there are more than 3 arguments.

$ bash apples oranges plums grapes
NO! Too many arguments!
assignments/assignment5.txt · Last modified: 2018/08/31 16:02 by david