KornShell Error 0403-004 Specify a parameter with this command
10,523
Solution:
Put double quotes around variable.
test.ksh
#! /usr/bin/ksh
if [ "${fooVariable}" = "" ]; then
fooVariable="fooString"
fi
echo "${fooVariable}"
Output:
@:/tmp #./test.ksh
fooString
Comments
-
javaPlease42 over 1 year
This KornShell code is throwing the following error:
test.ksh
#! /usr/bin/ksh if [ ${fooVariable} = "" ]; then fooVariable="fooString" fi echo "${fooVariable}"
Error:
@:/tmp #./test.ksh ./test.ksh[3]: test: 0403-004 Specify a parameter with this command.
Why is this error being thrown and how to fix it?
-
BarneySchmale over 9 yearsAlso you can use the special syntax that ksh provides for setting default values.
var1_with_default=${var1:=bar}; echo $var1_with_default