Declaring variables without initialization

I get an error in my shell script that line 1: )unexpected.
Line 1 in my script (using sh by the way) is the variable I declared but did not initialize it.

result=

Is this wrong? How can I fix it? I am using the variable later in the program, so I figured I could just declare it first without initializing it.

No need to declare variables in a shell script. The variables come to existence automatically when they are used. All the variables that do not exist are assumed to be null. So if you wish to give all the variables you wannt to use in your script to some default value, initialize them using

variable=value

Look like this?

/bin/sh: 1: Syntax error: "(" unexpected

Show us how you run the script. Line 1 should be

#!/bin/sh

If you are using the variable for the first time and no value has been set to it, use double-quotes to surround it

"$variable"

Please post what Operating System and version you are running and what Shell you run from your normal login.

uname -a
echo $SHELL

If this Solaris, /usr/bin/sh is the old Bourne Shell and it does not support $( ) syntax. If this is Solaris, use Korn Shell /usr/bin/ksh or (if installed) Bash /usr/bin/bash .

Btw. It is very confusing if you open a new thread whenever you have a problem with this script.