title: execute a function to place a file in unix
body: <pre class="lang-shell prettyprint-override"><code>sftp_upload()   
  {
    destination_server=$1 
    destination_path=$2
    destination_file_name=$3
    source_path=$4
    source_file_name=$5
    log_filename=$6
    port_number=$7
  
    if [ -z "$port_number" ] ; then 
      /usr/local/bin/sftp \
        $SFTP_OPTIONS \
          $SFTP_USERNAME@${destination_server} &gt;&gt; \
            ${log_filename} &lt;&lt;EOF 2&gt;&gt;${log_filename}
    else
      /usr/local/bin/sftp $SFTP_OPTIONS \
        -oPort=${port_number}$SFTP_USERNAME@${destination_server} &gt;&gt; \
          ${log_filename} &lt;&lt;EOF 2&gt;&gt;${log_filename}
    fi
  lcd ${source_path}
  cd ${destination_path}
  put $source_file_name $destination_file_name
  quit
  fi
  EOF
  }
  </code></pre>
  
  <p>above function in the script gives an error missing '}' at line 101</p>
  
  <p>My question is how to connect sftp in the if condition when the port number is not passed and if it is passed and how ?</p>