Expanding the PATH with a list of directories extracted from a text file, the '~' character not expanded to HOME
问题 The PATH is expanded by a list of directories extracted from a text file; $ cat ~/.path ~/.local/bin ~/W-space/esp/esp-open-sdk/xtensa-lx106-elf/bin ~/W-space/research/recognition/voxforge/bin ~/W-space/research/recognition/voxforge/bin/julius-4.3.1/bin like so (The following can be found in one of the BASH's startup files): declare -a BATH_ARRAY=($(cat ~/.path)) 2>/dev/null # extend path for BATH in "${BATH_ARRAY[@]}" do case ":${PATH}:" in *:${BATH}:*) ;; *) PATH=${PATH}:$BATH && export