How to output from running a \source command go into a file instead of screen ?
I tried both of these commands and it didnt work.
1. \source unit-test.sql | \tee tar.txt
2. \source unit-test.sql >> tar.txt
This was the scenario which we had discussed in the morning, instead of viewing the output of the \source in the screen, user can pipe the output to file.
|
|
70 KB
fixed.
this fixed potentially affects other scenarios with redirection and pipelining.
Awesome, thanks andy, working perfect except for one thing. Its displaying the error output to screen instead of capturing sending it to the file. attaching screen shot
Awesome, thanks andy, working perfect except for one thing. Its displaying the error output to screen instead of capturing sending it to the file. attaching screen shot
as designed: stderr is always redirected to screen.
as designed: stderr is always redirected to screen.
The output redirection for source does not work when tested with ADStudio 12 Dev 89.
Scenarios like below create the output.txt file, however the file is empty, nothing gets written into it, everything is printed on the screen.
Setup:
$ cd /tmp
$ echo 'pwd
echo hello
select 123 /' > input.txt
Test cases:
$ source input.txt > output.txt
$ source input.txt | tee > output.txt
$ source input.txt >> ouput.txt
The output redirection for source does not work when tested with ADStudio 12 Dev 89.
Scenarios like below create the output.txt file, however the file is empty, nothing gets written into it, everything is printed on the screen.
Setup:
$ cd /tmp
$ echo 'pwd
echo hello
select 123 /' > input.txt
Test cases:
$ source input.txt > output.txt
$ source input.txt | tee > output.txt
$ source input.txt >> ouput.txt
It is a bit of tricky to support this feature because the \source command can be executed nested, and the output of each executed commands defined in source scripts can go to same destination or different destinations; the destination of command output can be command specific or based on the destination of the containing script. The current design/implementation of fluid shell does not support this 'output destination relationship' well, I need to do something special to work around this problem. SVN r28020.
Below are test scripts I used to test r28020 FYI. These test scripts execute nested \source commands in 3 levels, the entry point is test-1.sh, I had tried executing test-1.sh in 3 different ways:
(1) prompt$ source test-1.sh
(2) prompt$ source test-1.sh > tmp.txt
(3) also executed test-1.sh using RunFluidShell
=== test-1.sh ===
cd c:/tmp/zzz/issue-6581-source-redirect
echo BEGIN-1
pwd
select top 1 * from orders @
echo "first-level redirect" > tmp.1
source test-2-1.sh
source test-2-2.sh > tmp.2
source test-2-3.sh
source test-2-4.sh
echo END-1
=== test-2-1.sh ===
cd c:/tmp/zzz/issue-6581-source-redirect
echo BEGIN-2-1
pwd
select top 2 * from orders @
echo "2.1: second-level redirect" > tmp.2.1
echo END-2-1
=== test-2-2.sh ===
cd c:/tmp/zzz/issue-6581-source-redirect
echo BEGIN-2-2
pwd
select top 2 * from orders @
echo "2.2: second-level redirect" > tmp.2.2
echo END-2-2
=== test-2-3.sh ===
cd c:/tmp/zzz/issue-6581-source-redirect
echo BEGIN-2-3
source test-3-1.sh
echo END-2-3
=== test-2-4.sh ===
cd c:/tmp/zzz/issue-6581-source-redirect
echo BEGIN-2-4
source test-3-2.sh > tmp.3
echo END-2-4
=== test-3-1.sh ===
cd c:/tmp/zzz/issue-6581-source-redirect
echo BEGIN-3-1
select top 3 * from orders @
echo "3.1: third-level redirect" > tmp.3.1
echo END-3-1
=== test-3-2.sh ===
cd c:/tmp/zzz/issue-6581-source-redirect
echo BEGIN-3-2
select top 3 * from orders @
echo "3.2: third-level redirect" > tmp.3.2
echo END-3-2
It is a bit of tricky to support this feature because the \source command can be executed nested, and the output of each executed commands defined in source scripts can go to same destination or different destinations; the destination of command output can be command specific or based on the destination of the containing script. The current design/implementation of fluid shell does not support this 'output destination relationship' well, I need to do something special to work around this problem. SVN r28020.
Below are test scripts I used to test r28020 FYI. These test scripts execute nested \source commands in 3 levels, the entry point is test-1.sh, I had tried executing test-1.sh in 3 different ways:
(1) prompt$ source test-1.sh
(2) prompt$ source test-1.sh > tmp.txt
(3) also executed test-1.sh using RunFluidShell
=== test-1.sh ===
cd c:/tmp/zzz/issue-6581-source-redirect
echo BEGIN-1
pwd
select top 1 * from orders @
echo "first-level redirect" > tmp.1
source test-2-1.sh
source test-2-2.sh > tmp.2
source test-2-3.sh
source test-2-4.sh
echo END-1
=== test-2-1.sh ===
cd c:/tmp/zzz/issue-6581-source-redirect
echo BEGIN-2-1
pwd
select top 2 * from orders @
echo "2.1: second-level redirect" > tmp.2.1
echo END-2-1
=== test-2-2.sh ===
cd c:/tmp/zzz/issue-6581-source-redirect
echo BEGIN-2-2
pwd
select top 2 * from orders @
echo "2.2: second-level redirect" > tmp.2.2
echo END-2-2
=== test-2-3.sh ===
cd c:/tmp/zzz/issue-6581-source-redirect
echo BEGIN-2-3
source test-3-1.sh
echo END-2-3
=== test-2-4.sh ===
cd c:/tmp/zzz/issue-6581-source-redirect
echo BEGIN-2-4
source test-3-2.sh > tmp.3
echo END-2-4
=== test-3-1.sh ===
cd c:/tmp/zzz/issue-6581-source-redirect
echo BEGIN-3-1
select top 3 * from orders @
echo "3.1: third-level redirect" > tmp.3.1
echo END-3-1
=== test-3-2.sh ===
cd c:/tmp/zzz/issue-6581-source-redirect
echo BEGIN-3-2
select top 3 * from orders @
echo "3.2: third-level redirect" > tmp.3.2
echo END-3-2
Issue #6581 |
| Closed |
| Fixed |
| Resolved |
Completion |
| No due date |
| Fixed Build trunk/28020 |
| No time estimate |
fixed.
this fixed potentially affects other scenarios with redirection and pipelining.