User Tools

Site Tools


assignments:assignment5

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 myscript.sh,

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

Question 3

Syntax.

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:

$ echo 'UUAGAUGCCCU' | tr YOUR_ARGUMENTS_HERE | rev
AGGGCATCTAA

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 student_script.sh 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 student_script.sh apples oranges plums grapes
NO! Too many arguments!
assignments/assignment5.txt · Last modified: 2018/08/31 16:02 by david