mirror of
				https://github.com/drwetter/testssl.sh.git
				synced 2025-10-30 21:35:26 +01:00 
			
		
		
		
	Fix: tput: No value for $TERM and no -T specified
Avoid "tput: No value for $TERM and no -T specified" when running from CGI or similar by checking for interactive shell
This commit is contained in:
		
							
								
								
									
										10
									
								
								testssl.sh
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								testssl.sh
									
									
									
									
									
								
							| @@ -93,9 +93,11 @@ date --help >/dev/null 2>&1 && \ | |||||||
| echo A | sed -E 's/A//' >/dev/null 2>&1 && \ | echo A | sed -E 's/A//' >/dev/null 2>&1 && \ | ||||||
|      readonly HAS_SED_E=true || \ |      readonly HAS_SED_E=true || \ | ||||||
|      readonly HAS_SED_E=false |      readonly HAS_SED_E=false | ||||||
| TERM_DWITH=${COLUMNS:-$(tput cols 2>/dev/null)}     # for future custom line wrapping |  | ||||||
| TERM_CURRPOS=0                          # ^^^ we also need to find out the length or current pos in the line |  | ||||||
|  |  | ||||||
|  | if [[ $- == *i*]]; then			#Prevent tput errors if running non interactive shell | ||||||
|  | 	TERM_DWITH=${COLUMNS:-$(tput cols 2>/dev/null)}     # for future custom line wrapping | ||||||
|  | 	TERM_CURRPOS=0                          # ^^^ we also need to find out the length or current pos in the line | ||||||
|  | fi | ||||||
|  |  | ||||||
| # following variables make use of $ENV, e.g. OPENSSL=<myprivate_path_to_openssl> ./testssl.sh <host> | # following variables make use of $ENV, e.g. OPENSSL=<myprivate_path_to_openssl> ./testssl.sh <host> | ||||||
| # 0 means (normally) true here. Some of the variables are also accessible with a command line switch | # 0 means (normally) true here. Some of the variables are also accessible with a command line switch | ||||||
| @@ -5199,7 +5201,9 @@ get_install_dir | |||||||
|  |  | ||||||
| initialize_globals | initialize_globals | ||||||
| parse_cmd_line "$@" | parse_cmd_line "$@" | ||||||
| set_color_functions | if [[ $- == *i* ]]; then			#Prevent tput errors if running non interactive shell | ||||||
|  | 	set_color_functions | ||||||
|  | fi | ||||||
| find_openssl_binary | find_openssl_binary | ||||||
| maketempf | maketempf | ||||||
| mybanner | mybanner | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Martin Hoffmann
					Martin Hoffmann