How to read this shell script?

myscript.sh

#!/bin/bash 
case "$1" in 
      ls|rm) 
            $1 "$0" 
            ;; 
      cp|mv) 
            "$1" "$0" "$2" 
            ;; 
      echo|mkdir) 
            "$1" "$2" 
            ;; 
      *) 
            "$0" ls 
            ;; 
esac

The script is called with ./myscript.sh mkdir cp.
$0 is the filename of the script, in this case myscript.sh. $1 and $2 are the parameters that the script is called with, in this case $1= mkdir, $2=cp - correct?
Here’s how I would try to phrase its first bit in an English sentence:

if “mkdir” is contained in the string “ls|rm”, do the following: mdkir myscript.sh

This would create a directory named myscript at the current location.

I’m just afraid I’m reading this all wrong:

  1. Maybe I don’t understand what case does, I think its similar to an if in a program
  2. I don’t understand the ls|rm syntax. Are these the options for the case-branching
  3. Is in actually how I interpreted it?
  4. the pipe |
  5. the *)
  6. Somtimes the $ variables are in double quotes ("$1"), sometimes they’re not ($1), I don’t get why.

Sorry, I realize this is a lot of “not a clue” in one place! I think it’s also a particularly mean exam question. Or am I just not smart enough…