~vcs-imports/busybox/trunk

« back to all changes in this revision

Viewing changes to shell/ash_test/ash-psubst/bash_procsub.tests

  • Committer: Denys Vlasenko
  • Author(s): Christian Franke
  • Date: 2023-11-13 10:32:35 UTC
  • Revision ID: git-v1:a63b60bdd6fa26b867c80d44074118babbae7ffd
Cygwin: regenerate defconfig

Signed-off-by: Christian Franke <christian.franke@t-online.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# simplest case
 
2
cat <(echo "hello 1")
 
3
 
 
4
# can have more than one
 
5
cat <(echo "hello 2") <(echo "hello 3")
 
6
 
 
7
# doesn't work in quotes
 
8
echo "<(echo \"hello 0\")"
 
9
 
 
10
# process substitution can be nested inside command substitution
 
11
echo $(cat <(echo "hello 4"))
 
12
 
 
13
# example from http://wiki.bash-hackers.org/syntax/expansion/proc_subst
 
14
# process substitutions can be passed to a function as parameters or
 
15
# variables
 
16
f() {
 
17
        cat "$1" >"$x"
 
18
}
 
19
x=>(tr '[:lower:]' '[:upper:]') f <(echo 'hi there')
 
20
 
 
21
# process substitution can be combined with redirection on exec
 
22
rm -f err
 
23
# save stderr
 
24
exec 4>&2
 
25
# copy stderr to a file
 
26
exec 2> >(tee err)
 
27
echo "hello error" >&2
 
28
sync
 
29
# restore stderr
 
30
exec 2>&4
 
31
cat err
 
32
rm -f err
 
33
echo "hello stderr" >&2