title: How to run an sh script in docker file?
body: <p>When running a sh script in docker file, i got the following error:</p>
  
  <blockquote>
    <p>./upload.sh: 5: ./upload.sh: sudo: not found ./upload.sh: 21:<br>
    ./upload.sh: Bad substitution</p>
  </blockquote>
  
  <pre><code>sudo chmod 755 upload.sh # line 5
  version=$(git rev-parse --short HEAD)
  echo "version $version"
  echo "Uploading file"
  
  for path in $(find public/files -name "*.txt"); do
    echo "path $path"
    WORDTOREMOVE="public/" 
    echo "WORDTOREMOVE $WORDTOREMOVE"
    # cause of the error
    newpath=${path//$WORDTOREMOVE/} # Line 21
    echo "new path $path"
    url=http://localhost:3000/${newpath}
    ...
    echo "Uploading file"
    ...
  done
  </code></pre>
  
  <p>DockerFile</p>
  
  <pre><code>FROM node:10-slim
  
  EXPOSE 3000 4001
  
  
  WORKDIR /prod/code
  ...
  COPY . .
  
  RUN ./upload.sh
  RUN npm run build
  CMD ./DockerRun.sh
  </code></pre>
  
  <p>Any idea?</p>