| 
									
										
										
										
											2016-10-10 19:26:29 +00:00
										 |  |  | #!/usr/bin/env bash | 
					
						
							| 
									
										
										
										
											2016-09-18 22:58:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-03 18:20:13 +00:00
										 |  |  | # Author: w0rp <devw0rp@gmail.com> | 
					
						
							|  |  |  | # Description: This script implements a wrapper for any program which does not accept | 
					
						
							|  |  |  | #   stdin input on most Unix machines. The input to the script is read to a | 
					
						
							|  |  |  | #   temporary file, and the first argument sets a particular file extension | 
					
						
							|  |  |  | #   for the temporary file. | 
					
						
							| 
									
										
										
										
											2016-09-18 22:58:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-03 18:20:13 +00:00
										 |  |  | # All of the following arguments are read as command to run. | 
					
						
							| 
									
										
										
										
											2016-09-18 22:58:04 +00:00
										 |  |  | file_extension="$1" | 
					
						
							|  |  |  | shift | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-10 20:53:56 +00:00
										 |  |  | temp_file=$(mktemp --tmpdir "ale-XXXXXXXXX$file_extension") | 
					
						
							| 
									
										
										
										
											2016-10-10 19:26:29 +00:00
										 |  |  | trap 'rm $temp_file' EXIT | 
					
						
							| 
									
										
										
										
											2016-09-18 22:58:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-03 16:40:02 +00:00
										 |  |  | while read -r; do | 
					
						
							| 
									
										
										
										
											2016-09-18 22:58:04 +00:00
										 |  |  |     echo "$REPLY" >> "$temp_file" | 
					
						
							|  |  |  | done | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | "$@" "$temp_file" |