diff --git a/bin/as.sh b/bin/as.sh index 0f0c78992b6..d9f3b488832 100755 --- a/bin/as.sh +++ b/bin/as.sh @@ -45,6 +45,11 @@ rreadlink() ( # Execute the function in a *subshell* to localize variables and t { \unalias command; \unset -f command; } >/dev/null 2>&1 [ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on # make zsh find *builtins* with `command` too. + if [ `command -v file` ] && [[ `command file $target` =~ broken ]]; then + echo 'Error:' `file $target` + return 1 + fi + while :; do # Resolve potential symlinks until the ultimate target is found. [ -L "$target" ] || [ -e "$target" ] || { command printf '%s\n' "ERROR: '$target' does not exist." >&2; return 1; } command cd "$(command dirname -- "$target")" # Change to target dir; necessary for correct resolution of target path. @@ -818,7 +823,9 @@ parse_arguments() echo "2. Try to use different http port, for example: as.sh --telnet-port 9998 --http-port 9999" exit 1 fi - elif [ -z ${TARGET_PID} ]; then + fi + + if [ -z ${TARGET_PID} ]; then # batch mode is enabled, no interactive process selection. echo "Illegal arguments, the is required." 1>&2 return 1