Shell running with nohup not work, but with sh command yes..

why, when i run my shell with sh command it run without problem, but when run with nohup nombreshell.sh $ command not run correctly... values obtained from database are not displayed in the csv file.

My shell do that:

1� data base access with sqlplus:

read_sql_stmt() {
typeset stmt=$1
typeset login=$2
echo "
set feedback off verify off heading off pagesize 0
$stmt;
exit
" | sqlplus -s $login

after, in the same shell script i use the function to obtain data

read_sql_stmt "select count(nros), categoria from tbl_nros_categoria_tmp where plan = 1 group by categoria" $CADENA_CONEXION | while
read var1 var2
do
        if [ $var2 = "CATEGORIA1" ]
        then
                let "a[1] = $var1"
        fi

        if [ $var2 = "CATEGORIA2" ]
        then
                let "a[2] = $var1"
        fi
done

and finally, i use data from array a[] to put on the csv file...

rm ../../files/result/resultadoCategorias.csv
echo "CATEGORIA1=${a[1]}" >> ../../files/result/resultadoCategorias.csv
echo "CATEGORIA2=${a[2]}" >> ../../files/result/resultadoCategorias.csv

thanks in advance... !!

PD: i use #!/bin/bash :smiley:

Are there any errors in the nohup.out file?

hi! thanks x your respose. there no errors in nohup.out file.

try putting $CADENA_CONEXION in double quotes. Maybe there is a character that is creating another argument.