cat ./1.sh
#!/bin/bash
echo $1
set var1 = $1
echo var1 is $var1
kostas@elem:~/1$ argument1 var1 is
How to set var1 from first commandline argument?
The correct assignment is simply the following, with no spaces on either side of the equal sign:
var1=$1
The command set var1 = $1 actually does the following:
$1 to "var1"$2 to "="$3 to the original first parameter $1.set for variable assignment (it serves a different purpose - see help set); instead, use <varname>=<value>, and be sure not to use whitespace on either side of the =.var="$1" is fine as well; the quotes are removed as usual before assigning the result to var.