#!/bin/bash DIR=$( cd "$( dirname "$0" )" && pwd ) check_env() { OLD_IFS="$IFS" IFS=":" array=($1) IFS="$OLD_IFS" install_path=${DIR%%latest*} for var in ${array[@]} do latest_path_num=$(echo $var | grep -o "/latest/" | wc -l) temp=${var%%latest*} if [ ${latest_path_num} -gt 0 ] && [ $install_path != $temp ]; then echo "error: User specified two different cann Installation package path: $install_path and $temp" return 1 fi done return 0 } main() { check_env $LD_LIBRARY_PATH ret1=$? check_env $PATH ret2=$? check_env $TOOLCHAIN_HOME ret3=$? if [ $ret1 -eq 1 ] || [ $ret2 -eq 1 ] || [ $ret3 -eq 1 ]; then echo "Please make sure source the correct cann package setenv.bash only. you can open a new window,and restart" exit 0 fi export _ASCENDC_DEBUG_TOOL_INSTALL_PATH=${DIR%%latest*} python3 -m ascendebug.cmd $@ } main $@