7 lines
		
	
	
		
			157 B
		
	
	
	
		
			Plaintext
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			7 lines
		
	
	
		
			157 B
		
	
	
	
		
			Plaintext
		
	
	
		
			Executable File
		
	
	
	
	
# In bash, "wait $!" extracts correct exitcode even if bg task has already exited
 | 
						|
# It prints 0, then 3:
 | 
						|
(sleep 0; exit 3) & sleep 1
 | 
						|
echo $?
 | 
						|
wait $!
 | 
						|
echo $?
 |