Bash: optimize cdf helper.