Your question implies you don't have the basics, which means you will be asking the next basic question after this one, and then another, and another...
You may also want to post actual command execution and results, because I can't tell what you "ran" to get your results.
If your script is compdir, then it must be executable and is run by either being in your PATH statement or called explicitly with:
Code:
./compdir dir1 dir2
Also, what happens if the dir names have spaces in them?
It is also *fairly standard* convention to name Bash shell scripts with a .sh extension, which would make your script compdir.sh.
This is all covered in the linked guide and reading/understanding it (not *scanning it*) will save you a lot of headaches.
Is it a file or directory? String Comparison
Edited: Removed variable reference.