Problem Shell Script

hy,

i have a problem with shell script with sybase. if start single command this script working, but if run into file for example select.sh, the script doesn't create output. Can you help me please ??? thank's

USER=`cat $SYBASE/.asepwd | cut -d: -f2 | head -1`
PWD=`asepwd.sh $USER $DSQUERY`
DATE=`date "+%d%m%Y"`
isql -U$USER -P$PWD -w10000 -oprova.out << EOF
select name from sysdatabases where dbid > 4 and dbid < 15
go
EOF

Please use code tags for code. [ code ] stuff [ /code ] without the spaces in the tags. they make fixed-width things like code readable, hence the name 'code' and 'code tags'.

That is the complete script? Where is $SYBASE and $DSQUERY defined?

Also, it'd be a good idea to use a variable name other than PWD. PWD is already used by the shell to store the working directory.

$SYBASE, $DSQUERY are defined into .profile. I work with bash shell and $USER and $PWD are defined into file.

i don't understand because it doesn't work

PWD is a reserved variable that changes by itself every time you cd, don't use it.

Unless a variable is actually exported from your shell it may not be passed along into a script you run from it.

Try to echo the command before you execute it for debugging purposes to make sure all your variables are correct. See if it displays like it should.

USER=`cat $SYBASE/.asepwd | cut -d: -f2 | head -1`
PWD=`asepwd.sh $USER $DSQUERY`
DATE=`date "+%d%m%Y"`
echo "isql -U$USER -P$PWD -w10000 -oprova.out"
isql -U$USER -P$PWD -w10000 -oprova.out << EOF
select name from sysdatabases where dbid > 4 and dbid < 15
go
EOF