file created can not be read inside script

September 19, 2011 at 23:32:57
Specs: Windows 7
I am running cygwin in windows and have a script that creates a file using '>' and update that file using '>>' -- all within the script.

From within the same script, I would run an 'isql' using that file but cygwin would say "here docuemnt "xxx" unclosed". and not read the file.

after the script exits, the file can be accessed !

See More: file created can not be read inside script

Report •

September 20, 2011 at 12:39:13
I am not a cygwin user, but a unix-type shell should not act this way. I suggest you try placing the commands that create and update files with '>' and '>>' within parenthesis. This forces the spawn of a new shell.

Here is an example:

echo "hello world" > myfile.txt
echo $x

echo $x # reverts back to 5

When the new shell is spawned, the myfile.txt file should be created, I change the value of x to 7. This demonstrates that a new shell was created when x reverts back to 5.

Report •
Related Solutions

Ask Question