title: Commands cannot be recognised in a .sh file in AWS-IoT-Chat setup
body: <p>I have a code from the <strong><a href="https://github.com/awslabs/aws-iot-chat-example" rel="nofollow noreferrer">git url</a></strong> for AWS IoT Chat using React code. When this setup is executed, it makes the required configuration on associated AWS platform and the UI setup individually on your local machine(when done on local machine), Complete setup runs perfectly fine until a stage comes where the .sh files are supposed to be executed to trigger the aws lambda functions.</p>
  
  <p>Here a file called "<strong>attachConfirmUserTrigger.sh</strong>" starts the execution during the server setup, but it breaks with the below error:</p>
  
  <pre><code>Serverless: Running after:aws:deploy:finalize:cleanup command: "./scripts/attachConfirmUserTrigger.sh"
  '.' is not recognized as an internal or external command,
  operable program or batch file.
  
    Error --------------------------------------------------
  
    Command failed: ./scripts/attachConfirmUserTrigger.sh
  '.' is not recognized as an internal or external command,
  operable program or batch file.
  </code></pre>
  
  <p>To analyze, below is the code written in <strong>attachConfirmUserTrigger.sh</strong> file</p>
  
  <pre><code>##!/bin/bash
  
  # This script is used until a bug regarding Cognito User Pools in serverless is fixed
  # https://github.com/serverless/serverless/pull/3799
  
  STACK_NAME="iot-chat-api-prod"
  
  function fail(){
    tput setaf 1; echo "Failure: $*" &amp;&amp; tput sgr0
    exit 1
  }
  
  function info() {
    tput setaf 6; echo "$*" &amp;&amp; tput sgr0
  }
  
  function success() {
    tput setaf 2; echo "$*" &amp;&amp; tput sgr0
  }
  
  function check_aws() {
    info "checking aws cli configuration..."
  
      if ! [ -f ~/.aws/config ]; then
          if ! [ -f ~/.aws/credentials ]; then
              fail "AWS config not found or CLI not installed. Please run \"aws configure\"."
          fi
      fi
  
    success "aws cli is configured"
  }
  
  function check_jq() {
    info "checking if jq is installed..."
  
    if ! [ -x "$(command -v jq)" ]; then
      fail "jq is not installed."
    fi
  
    success "jq is installed"
  }
  
  function check_stack() {
    info "checking if $STACK_NAME exists..."
  
    summaries=$(aws cloudformation list-stacks | jq --arg STACK_NAME "$STACK_NAME" '.StackSummaries |
      .[] | select((.StackName ==
    $STACK_NAME) and ((.StackStatus == "CREATE_COMPLETE") or (.StackStatus == "UPDATE_COMPLETE")))')
    if [ -z "$summaries" ]
    then
      fail "The StackStatus of '$STACK_NAME' is not CREATE_COMPLETE or UPDATE_COMPLETE"
    fi
  
    success "$STACK_NAME exists"
  }
  
  function attach_trigger() {
    info "Attaching autoConfirmUser Lambda as PreSignUp trigger"
  
    # Get all CloudFormation Outputs
    outputs=$(aws cloudformation describe-stacks --stack-name $STACK_NAME | jq '.Stacks | .[] |
      .Outputs | .[]')
    user_pool_id=$(echo $outputs | jq --raw-output 'select(.OutputKey == "UserPoolId") | .OutputValue')
    lambda_arn=$(echo $outputs | jq --raw-output 'select(.OutputKey == "AutoConfirmUserFnArn") | .OutputValue')
  
    aws cognito-idp update-user-pool --user-pool-id ${user_pool_id} --lambda-config PreSignUp=${lambda_arn}
    success "Attached PreSignUp trigger"
  }
  
  check_aws
  check_jq
  check_stack
  attach_trigger
  </code></pre>
  
  <p><strong>Note:</strong> Server is configured after we hit "serverless deploy" command on the terminal</p>
  
  <p>I cannot find where does it find the . which not recognizable. Please help.</p>
  
  <p><strong>Update:</strong> Adding to the information provided above,  bash function retrieves the lambda function ARN and updates the user pool's triggers.</p>