nvl function in lunix

i wanna write these pl/sql codes in lunix.

pl/sql:

if pi_start_date is null
then 
  pi_start_date := sysdate;
end if;

unix:

if [-n pi_start_date] then 
  $pi_start_date=`date +%Y%m%d`
fi;

but this isnt correct.

ty for helps

if [ -z "$pi_start_date"  ] ; then 
$pi_start_date=`date +%Y%m%d`
fi

Note the spaces around the [ and ]

fixed typo.

Hi imtheone ,

test -n returns true when the length of the tested string is nonzero, and there are some other issues with your code.
Try this:

if [ -z "$pi_start_date" ]; then
   pi_start_date=`date +%Y%m%d`
fi

@jim mcnamara
i got syntax error about fi
ty for help

@cero
ty so much.
it is correct.