title: Shell script partially sourcing functions
body: <p>I have a shell script am sourcing in the format . custom_functions.sh. It has worked well in the past but there is this one machine, where it is partially sourcing the functions and leaving out others. I am using it on hp prodesk running Ubuntu 18.04. </p>
  
  <p><strong>Additional Information</strong>
  I have a several custom functions for quick formatting, installation etc in one file (called custom_functions.sh).  I normally source this file into other other scripts for re-use. Here is a a portion of the file:</p>
  
  <pre><code># !/bin/bash
  
  # custom_functions.sh
  
  . colour.sh
  
  function commaToSpace()
  {
      sed -r 's/,/ /g'
  }
  function hyphenToCamel()
  { 
      tr '_' '\n' | awk '{printf "%s%s", toupper(substr($0,1,1)), substr($0,2)}'
  }
  function camelToHyphen()
  {
      sed -r 's/([A-Z])/_\L\1/g'
  }
  function hyphenToSentence()
  { 
      tr '_' ' ' | awk '{printf "%s%s", toupper(substr($0,1,1)), substr($0,2)}'
  }
  function spaceToCamel()
  { 
      tr ' ' '\n' | awk '{printf "%s%s", toupper(substr($0,1,1)), substr($0,2)}'
  }
  function lowerCase()
  {
      tr '[:upper:]' '[:lower:]'
  }
  function properCase()
  {
      tr '[:upper:]' '[:lower:]' | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}'
  }
  function stringSortDropDuplicatesNums()
  {
      string=$(awk '{print !a[$0]++}' &lt;&lt;&lt; "$1")
      printf '%s\n' "${string//[[:digit:]]/}"
  }
  function trimString(){
      tr -d '\040\011\012\015'
  }
  .
  .
  .
  </code></pre>
  
  <p><strong>Only a number of these functions*</strong> are being sourced by other scripts in the said machine and the remaining towards the end of the file are skipped. If I rename this file and source it, then all the functions are included. Notice, I have ensured there are no name clashes. This phenomenon has only been observed in a specific machine, and other types of the same machine running the same operating system have no problem. Thanks.</p>