~ubuntu-branches/ubuntu/trusty/bash/trusty-security

« back to all changes in this revision

Viewing changes to tests/redir4.sub

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-03-03 22:52:05 UTC
  • mfrom: (1.3.5) (2.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20140303225205-87ltrt5kspeq0g1b
Tags: 4.3-1ubuntu1
* Merge with Debian; remaining changes:
  - skel.bashrc:
    - Run lesspipe.
    - Enable ls aliases.
    - Set options in ll alias to -alF.
    - Define an alert alias.
    - Enabled colored grep aliases.
  - etc.bash.bashrc:
    - Add sudo hint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
minus=-
 
2
 
 
3
# standard input
 
4
fd=0
 
5
 
 
6
exec 3<&$fd
 
7
 
 
8
read line <&3
 
9
echo from stdin: $line
 
10
 
 
11
# close fd 3
 
12
exec 3<&${minus}
 
13
 
 
14
# should give `bad fd', but exact error messages vary
 
15
# read line <&3
 
16
 
 
17
# standard output
 
18
fd=1
 
19
 
 
20
exec 4>&$fd
 
21
 
 
22
echo to stdout >&4
 
23
 
 
24
exec 4>&$minus
 
25
 
 
26
# should give `bad fd', but exact error messages vary
 
27
# echo to stdout >&4
 
28
 
 
29
unset fd
 
30
 
 
31
# these are ambiguous redirects
 
32
exec 3<&$fd
 
33
exec 4>&$fd
 
34
 
 
35
exec 3>&1 4>&2
 
36
 
 
37
exec >&/tmp/err-and-out
 
38
echo to stdout
 
39
echo to stderr >&2
 
40
 
 
41
exec 1>&3 2>&4
 
42
echo /tmp/err-and-out:
 
43
cat /tmp/err-and-out
 
44
 
 
45
rm /tmp/err-and-out
 
46
 
 
47
fd=/tmp/err-and-out
 
48
exec >&$fd
 
49
echo to stdout
 
50
echo to stderr >&2
 
51
 
 
52
exec 1>&3 2>&4
 
53
echo /tmp/err-and-out:
 
54
cat /tmp/err-and-out
 
55
 
 
56
rm /tmp/err-and-out