Closed superxcgm closed 3 years ago
tasking:
Redirect stderr to other file (override)
Given: User type some-command 2> a.out
(For example: echo '1 / 0' | bc 2> a.out
)
When: User hit <Enter>
Then: ✅ shell should clear content of file a.out
redirect stderr to a.out
Redirect stderr to other file (append)
Given: User type some-command 2>> a.out
(For example: echo '1 / 0' | bc 2>> a.out
)
When: User hit <Enter>
Then: ✅ shell should not clear content of file a.out
, redirect stderr to end of a.out
Redirect stderr to same as stdout (override)
Given: User type some-command > a.out 2>&1
(For example: echo '1 / 0' | bc > a.out 2>&1
)
When: User hit <Enter>
Then: ✅ shell should clear content of file a.out
, redirect stderr and stdout to a.out
Redirect stderr to same as stdout (append)
Given: User type some-command >> a.out 2>&1
(For example: echo '1 / 0' | bc >> a.out 2>&1
)
When: User hit <Enter>
Then: ✅ shell should not clear content of file a.out
, redirect stderr and stdout to end of a.out
Redirect stderr to different file as stdout
Given: User type some-command > a.out 2> b.out
When: User hit <Enter>
Then: ✅shell should clear content of file a.out
redirect stdout to a.out
, and clear content of file b.out
redirect stderr to b.out
.
Test case already add to functional test.
Epic
Process
Description
Shell should able to redirect stderr to other file or same as stdout.
AC
Redirect stderr to other file (override) Given: User type
some-command 2> a.out
(For example:echo '1 / 0' | bc 2> a.out
) When: User hit<Enter>
Then: shell should clear content of filea.out
redirect stderr toa.out
Redirect stderr to other file (append) Given: User type
some-command 2>> a.out
(For example:echo '1 / 0' | bc 2>> a.out
) When: User hit<Enter>
Then: shell should not clear content of filea.out
, redirect stderr to end ofa.out
Redirect stderr to same as stdout (override) Given: User type
some-command > a.out 2>&1
(For example:echo '1 / 0' | bc > a.out 2>&1
) When: User hit<Enter>
Then: shell should clear content of filea.out
, redirect stderr and stdout toa.out
Redirect stderr to same as stdout (append) Given: User type
some-command >> a.out 2>&1
(For example:echo '1 / 0' | bc >> a.out 2>&1
) When: User hit<Enter>
Then: shell should not clear content of filea.out
, redirect stderr and stdout to end ofa.out
Redirect stderr to different file as stdout Given: User type
some-command > a.out 2> b.out
When: User hit<Enter>
Then: shell should clear content of filea.out
redirect stdout toa.out
, and clear content of fileb.out
redirect stderr tob.out
.Demo test c code for case 5.