Tapatalk

Code folding problem with bash script (solved)

Code folding problem with bash script (solved)

2
NewbieNewbie
2

    May 01, 2014#1

    I'm new to UE, and I've come across a problem with code folding/syntax highlighting in my bash script.
    UE isn't associating the first "if" with the last "fi", and I think I see why altho I don't know how to fix it.
    My code has several "echo" statements that contain the word "if", and these seem to be confusing UE.
    any way to fix this?

    here's the Fold Strings piece from my bash uew file;

    Code: Select all

    /Open Fold Strings = "{" "if" "elif" "do"
    /Close Fold Strings = "}" "elif" "fi" "done"
    and here's the piece of bash script that's having the problem;

    Code: Select all

    if [[ ! -f "${RDBR_KSH_Script}" || -z "${RDBR_KSH_Script}" ]]; 
    then
     case "${product}" in 
      "Oracle")
             RDBR_KSH_Script=/scm/pvcs/scripts/Database/Common/run_oradb_change.sh;
             ;;
      *)
             summary=$(
             echo -e "\n#################### auto_db_load - RDBR KSH Product file entry is ABSENT - Aborted ####################\n";
             echo -e "Error: No entry in Master config file for Products RDBR KSH shell file. Exiting with exit_code=173.";
             echo -e "   OR: Please check if the file has read permission if entry exist in the Master configuration file.";
             echo -e "   OR: User interrupted the script while MKDIR operation was in progress in progres.";
             echo -e "\n\nMaster config file         : \"${mcfile}\"";
             echo -e "RDBR_KSH_Script was set to : \"${RDBR_KSH_Script}\"";
             echo -e "Product was set to         : \"${product}\"\n";);
             echo "${summary}" | tee -a "${LOG_FILE}";
             exit_code=173; kill -15 $$;
             ;;
     esac
    else
     ##-r on file readability test was acting up, so used cat command. 
     cat "${RDBR_KSH_Script}" 1>/dev/null 2>&1; 
     ReturnCode=$?; 
     if [[ ${ReturnCode} -ne 0 ]];
     then
      summary=$(
      echo -e "\n#################### auto_db_load - RDBR KSH Product file is not readable - Aborted ####################\n";
      echo -e "Error: RDBR KSH Shell file is not readable. Exiting with exit_code=174.";
      echo -e "   OR: Please check if the file has read permission for user running this automation script.";
      echo -e "   OR: User interrupted the script while MKDIR operation was in progress in progres.";
      echo -e "\n\nRDBR_KSH_Script was set to : \"${RDBR_KSH_Script}\"";
      echo -e "Product was set to         : \"${product}\"\n";);
      echo "${summary}" | tee -a "${LOG_FILE}";
      exit_code=174; kill -15 $$;
     fi
    fi

    6,685587
    Grand MasterGrand Master
    6,685587

      May 01, 2014#2

      UltraEdit ignores open/close fold strings in comments and strings. You have not posted the first line of your wordfile for syntax highlighting bash scripts. So I can only suppose that it contains either Noquote to disable string highlighting completely, or String Chars = with 1 or 2 characters is specified and the double quote character is not one of the string characters.

      The solution is in this case to insert below the 2 lines you posted one more line

      /Ignore Fold Strings = "echo"

      UltraEdit ignores with this additional line in the wordfile all lines containing the word echo outside a comment or string on searching for open/close fold strings.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        May 01, 2014#3

        wow, you're good!

        that did it, thanks!