add trap handling
This commit is contained in:
		
							parent
							
								
									7838b0c6e0
								
							
						
					
					
						commit
						3a0423ad49
					
				| @ -4,6 +4,8 @@ | |||||||
| ## borg helper script for viewing and restoring backups | ## borg helper script for viewing and restoring backups | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
|  | ### trap | ||||||
|  | trap trapExit 1 2 3 6 | ||||||
| 
 | 
 | ||||||
| ### functions | ### functions | ||||||
| consoleError() { | consoleError() { | ||||||
| @ -16,6 +18,11 @@ textblock() { | |||||||
|     printf "%s\n" "$1" | fold -w "$width" -s |     printf "%s\n" "$1" | fold -w "$width" -s | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | trapExit () { | ||||||
|  |     printf "%s\nScript execution terminated via signal.\n\n%s" "$err" "$norm" | ||||||
|  |     exit 99 | ||||||
|  | } | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| ### text formatting presets | ### text formatting presets | ||||||
| err=$(tput bold)$(tput setaf 1) | err=$(tput bold)$(tput setaf 1) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user