Problem with the script, help me debug

Hi,

When i run the script ./script.sh sun, this give me no output, it should give me the list of file.
If i run the script without the argument it should send me echo inside usage().
What is the problem?

please help

-Adsi

#!/bin/sh

ROOT_PATH=/net/icebox/vol/local_images/spins
STREAM_PATH=$ROOT_PATH/7.1

usage(){
 $echo "Usage: [sun]"
}

check_sun() {
ls $STREAM_PATH
}

main(){
if [ $# -eq 0 ]; then
  usage
  exit 0
fi

PLATFORM_LIST="$*"
if ["$1" = "sun" ]; then
  check_sun
fi
exit 0
}

Script needs some minor changes to get it to run.
1) Change "$echo" to just "echo"
2) Lose the "main" or all the script becomes subroutines and nothing happens.
3) Space character after "[". Not a syntax error but does make the script misbehave.
4) After testing this version, consider what happens if one parameter is provided but it is not "sun". Also if two parameters are provided.

#!/bin/sh
 
ROOT_PATH=/net/icebox/vol/local_images/spins
STREAM_PATH=$ROOT_PATH/7.1
 
usage(){
echo "Usage: [sun]"
}
 
check_sun() {
ls $STREAM_PATH
}
 
# Processing starts here
if [ $# -eq 0 ]; then
usage
exit 0
fi
 
PLATFORM_LIST="$*"
if [ "$1" = "sun" ]; then
check_sun
fi
exit 0

That was perferct.

Thank you