diff --git a/cmc b/cmc index 3fdc080..8da4e56 100755 --- a/cmc +++ b/cmc @@ -72,15 +72,16 @@ config_control_path() { # Extract ControlPath from SSH config local _result _result_count _result=$(awk \ - 'tolower($1) ~ /^controlpath$/ { + '/^ *#/ || /^ *$/{next} + tolower($1) ~ /^controlpath$/ { if ( tolower($2) !~ /^none$/ ) { print $2 } - }' ${SSH_CONFIG}) + }' ${SSH_CONFIG} | sort -u) if [[ -n "${_result}" ]] then # Only a single ControlPath should be specified - _result_count=$(echo "${_result}" | sort -u | wc -l) + _result_count=$(echo "${_result}" | wc -l) if (( _result_count > 1 )) then error_exit "multiple ControlPaths specified: ${_result}"