-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathredirection.yaml
78 lines (66 loc) · 1.75 KB
/
redirection.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: "Redirection"
cases:
- name: "Redirection to null"
stdin: |
echo hi >/dev/null
- name: "Output redirection to file"
stdin: |
echo hi >out.txt
ls out.txt
cat out.txt
- name: "Output redirection to file (append)"
stdin: |
echo hi >>out.txt
echo there >>out.txt
ls out.txt
cat out.txt
- name: "Input redirection from file"
test_files:
- path: "in.txt"
contents: |
Something here.
stdin: |
cat <in.txt
- name: "Redirection to fd"
stdin: |
echo hi >&2
- name: "Process substitution: basic"
stdin: |
shopt -u -o posix
echo <(:) >(:)
echo <(:) <(:)
echo >(:) >(:)
- name: "Process substitution: not in simple commands"
known_failure: true # Known to fail because we are only handling them in simple commands now
stdin: |
shopt -u -o posix
for f in <(echo hi); do echo $f; done
- name: "Process substitution: builtins"
stdin: |
source <(echo VAR=100)
echo "var: ${VAR}"
- name: "Process substitution: input redirection"
stdin: |
shopt -u -o posix
cat < <(echo hi)
- name: "Process substitution: output redirection"
skip: true # TODO: Test is flaky; needs work.
stdin: |
shopt -u -o posix
echo hi > >(wc -l)
echo hi >> >(wc -l)
- name: "Process substitution: input"
stdin: |
shopt -u -o posix
var="value"
cat <(var="updated"; echo ${var})
echo "Done."
echo "${var}"
- name: "Redirect stdout and stderr"
stdin: |
ls -d . non-existent-dir &>/dev/null
ls -d . non-existent-dir &>>/dev/null
- name: "Process substitution: input + output"
stdin: |
shopt -u -o posix
cp <(echo hi) >(cat)