| 
									
										
										
										
											1997-06-05 14:59:13 +00:00
										 |  |  | abc | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | ./redir.tests: line 15: /tmp/redir-test: cannot overwrite existing file | 
					
						
							| 
									
										
										
										
											1997-06-05 14:59:13 +00:00
										 |  |  | abc | 
					
						
							|  |  |  | def | 
					
						
							|  |  |  | def | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | ./redir.tests: line 31: $z: ambiguous redirect | 
					
						
							| 
									
										
										
										
											1997-06-05 14:59:13 +00:00
										 |  |  | Point 1 | 
					
						
							|  |  |  | Point 2 | 
					
						
							|  |  |  | to a | 
					
						
							|  |  |  | to b | 
					
						
							|  |  |  | Point 3 | 
					
						
							|  |  |  | to a | 
					
						
							|  |  |  | to a | 
					
						
							|  |  |  | to b | 
					
						
							|  |  |  | to b | 
					
						
							|  |  |  | Point 4 | 
					
						
							|  |  |  | to c | 
					
						
							|  |  |  | Point 5 | 
					
						
							|  |  |  | this is redir1.sub | 
					
						
							|  |  |  | this is redir2.sub | 
					
						
							|  |  |  | read line1 "ab" | 
					
						
							|  |  |  | read line2 "root" | 
					
						
							|  |  |  | read line3 "cd" | 
					
						
							|  |  |  | read line4 "daemon" | 
					
						
							|  |  |  | from stdin: aa | 
					
						
							|  |  |  | to stdout | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | ./redir4.sub: line 32: $fd: ambiguous redirect | 
					
						
							|  |  |  | ./redir4.sub: line 33: $fd: ambiguous redirect | 
					
						
							| 
									
										
										
										
											1997-06-05 14:59:13 +00:00
										 |  |  | /tmp/err-and-out: | 
					
						
							|  |  |  | to stdout | 
					
						
							|  |  |  | to stderr | 
					
						
							|  |  |  | /tmp/err-and-out: | 
					
						
							|  |  |  | to stdout | 
					
						
							|  |  |  | to stderr | 
					
						
							|  |  |  | 0 -- 3 0 | 
					
						
							|  |  |  | 0 -- 4 0 | 
					
						
							|  |  |  | ab | 
					
						
							|  |  |  | cd | 
					
						
							|  |  |  | ef | 
					
						
							|  |  |  | gh | 
					
						
							|  |  |  | ij | 
					
						
							|  |  |  | kl | 
					
						
							|  |  |  | 0 | 
					
						
							|  |  |  | ab | 
					
						
							|  |  |  | cd | 
					
						
							|  |  |  | cd | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | ./redir.tests: line 154: redir1.*: No such file or directory | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | # tests of ksh93-like dup-and-close redirection operators | 
					
						
							|  |  |  | exec 9<$0 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | f() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | exec 5<$0 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | exec 0<&5- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | while read line; do | 
					
						
							|  |  |  | echo "$line" | 
					
						
							|  |  |  | done | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | f | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typeset -f f | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # make sure it was closed | 
					
						
							|  |  |  | read -u 5 foo | 
					
						
							|  |  |  | echo after read | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | exec 5<&0 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | exec <&- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | read abcde | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | exec 0<&9- | 
					
						
							|  |  |  | read line | 
					
						
							|  |  |  | echo $line | 
					
						
							|  |  |  | f ()  | 
					
						
							|  |  |  | {  | 
					
						
							| 
									
										
										
										
											2006-10-10 14:15:34 +00:00
										 |  |  |     exec 5< $0; | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  |     exec 0<&5-; | 
					
						
							|  |  |  |     while read line; do | 
					
						
							|  |  |  |         echo "$line"; | 
					
						
							|  |  |  |     done | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | ./redir5.sub: line 20: read: 5: invalid file descriptor: Bad file descriptor | 
					
						
							|  |  |  | after read | 
					
						
							|  |  |  | ./redir5.sub: line 27: read: read error: 0: Bad file descriptor | 
					
						
							|  |  |  | # tests of ksh93-like dup-and-close redirection operators | 
					
						
							| 
									
										
										
										
											2004-07-27 13:29:18 +00:00
										 |  |  | / | 
					
						
							|  |  |  | / | 
					
						
							|  |  |  | / | 
					
						
							|  |  |  | 0 | 
					
						
							|  |  |  | 0 | 
					
						
							|  |  |  | 0 | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  | before block | 
					
						
							|  |  |  | after block | 
					
						
							|  |  |  | c1 is 1 | 
					
						
							|  |  |  | c2 is 2 | 
					
						
							|  |  |  | c3 is 3 | 
					
						
							|  |  |  | c4 is 4 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | fd 10 | 
					
						
							|  |  |  | fd 8 | 
					
						
							|  |  |  | fd 10 | 
					
						
							|  |  |  | fd 8 | 
					
						
							|  |  |  | 1 | 
					
						
							|  |  |  | 2 | 
					
						
							|  |  |  | 3 | 
					
						
							|  |  |  | 4 | 
					
						
							|  |  |  | 1 | 
					
						
							|  |  |  | 2 | 
					
						
							|  |  |  | 3 | 
					
						
							|  |  |  | 4 | 
					
						
							|  |  |  | cat /tmp/foo | 
					
						
							|  |  |  | whatsis | 
					
						
							|  |  |  | hey | 
					
						
							|  |  |  | to stdout | 
					
						
							|  |  |  | to stderr | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | to stdout | 
					
						
							|  |  |  | to stderr | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | to stderr | 
					
						
							|  |  |  | to stdout | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | to stderr | 
					
						
							|  |  |  | hey | 
					
						
							|  |  |  | to stdout | 
					
						
							|  |  |  | logfunc is a function | 
					
						
							|  |  |  | logfunc ()  | 
					
						
							|  |  |  | {  | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  |     echo "$@" &>> $TMPDIR/log | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | } | 
					
						
							|  |  |  | foo | 
					
						
							|  |  |  | bix is a function | 
					
						
							|  |  |  | bix ()  | 
					
						
							|  |  |  | {  | 
					
						
							|  |  |  |     echo foo 2>&1 | cat | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | foo | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | 
					
						
							| 
									
										
										
										
											2016-09-15 16:59:08 -04:00
										 |  |  | 1 | 
					
						
							|  |  |  | ./redir11.sub: line 8: $a: Bad file descriptor | 
					
						
							|  |  |  | ./redir11.sub: line 9: $(echo $a): Bad file descriptor | 
					
						
							|  |  |  | 7 | 
					
						
							|  |  |  | after: 42 | 
					
						
							|  |  |  | ./redir11.sub: line 24: echo: write error: Bad file descriptor | 
					
						
							|  |  |  | ./redir11.sub: line 25: echo: write error: Bad file descriptor | 
					
						
							|  |  |  | ./redir11.sub: line 26: $(a=4 foo): Bad file descriptor | 
					
						
							|  |  |  | ./redir11.sub: line 27: $(a=4 foo): Bad file descriptor | 
					
						
							|  |  |  | ./redir11.sub: line 30: $a: Bad file descriptor | 
					
						
							|  |  |  | ./redir11.sub: line 31: $(echo $a): Bad file descriptor | 
					
						
							|  |  |  | ./redir11.sub: line 39: $(ss= declare -i ss): ambiguous redirect | 
					
						
							|  |  |  | after: 42 | 
					
						
							|  |  |  | a+=3 | 
					
						
							|  |  |  | foo | 
					
						
							|  |  |  | foo | 
					
						
							|  |  |  | ./redir11.sub: line 53: $(echo $a): Bad file descriptor | 
					
						
							|  |  |  | 123 |