Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

...

...

The first line is the she-bang. It Even though the expression is inside a shell comment (denoted by the # character), it tells the shell what program should execute this file – in this case, bash itself – even though the expression is inside a shell comment (denoted by the # character).

Code Block
languagebash
titleThe "she-bang" line
#!/bin/bash

...

Environment variables are like variables in a programming language like python or perl (in fact bash is a complete programming language). They have a name (like BIWORK above) and a value (the value for BIWORK is the pathname /work/projects/BioITeam). Read more about environemt environment variables here: More on environment variables.

...

Code Block
languagebash
titleShell completion exercise
# hit Tab once after typing $BIWORK/ to expand the environment variable
ls $BIWORK/

# now hit Tab twice to see the contents of the directory
ls /work/projects/BioITeam/

# type "pr" and hit Tab again
ls /work/projects/BioITeam/pr

# type "co" and hit Tab again
ls /work/projects/BioITeam/projects/co

# type "Co" and hit Tab again
ls /work/projects/BioITeam/projects/courses/Co

# your command line should now look like this
ls /work/projects/BioITeam/projects/courses/Core_NGS_Tools/

# now type "mmi" and one Tab
ls /work/projects/BioITeam/projects/courses/Core_NGS_Tools/mmi

# your command line should now look like this
ls /work/projects/BioITeam/projects/courses/Core_NGS_Tools/misc/

# now hit Tab once
# the shell expands as far as it can unambiguously,
# so your command line should look like this
ls /work/projects/BioITeam/projects/courses/Core_NGS_Tools/misc/small

# now hit Tab twice
# You should see 3 filenames, all starting with "small"

# type a period (".") then hit Tab twice again
# You're narrowing down the choices -- you should see two filenames
ls /work/projects/BioITeam/projects/courses/Core_NGS_Tools/misc/small

# finally, type "f" then hit Tab again. It should complete to this:
ls /work/projects/BioITeam/projects/courses/Core_NGS_Tools/misc/small.fq

...