The tilde (~) comparison will not match the actual home directory path. The shell expands ~ to the full home directory path before the comparison, so this check will never match a user's home directory. Use "$TARGET_DIR" == "$HOME" to properly check for the home directory.
if [[ -z "$TARGET_DIR" || "$TARGET_DIR" == "/" || "$TARGET_DIR" == "~" || "$TARGET_DIR" == "$HOME" || "$TARGET_DIR" == "." || "$TARGET_DIR" == ".." ]]; then
The tilde (~) comparison will not match the actual home directory path. The shell expands ~ to the full home directory path before the comparison, so this check will never match a user's home directory. Use
"$TARGET_DIR" == "$HOME"to properly check for the home directory.Originally posted by @copilot-pull-request-reviewer in https://github.com/MunyayLLC/shadowsocks-android/pull/18#discussion_r2374844852