title: Linux bash shell script prompt user input and store in variable
body: <p>How do I collect user input and store in variables to use in parameters for jar file execution?</p>
  
  <p>Tried using read -p and bash's select command from following link but get errors: <a href="https://stackoverflow.com/questions/226703/how-do-i-prompt-for-input-in-a-linux-shell-script#">How do I prompt for Yes/No/Cancel input in a Linux shell script?</a> 
  here is what I have so far:</p>
  
  <pre><code>#!/bin/bash
  
  echo "Hello "$USER"."
  echo "Enter System :"
  read name
  echo "Enter Format (JPG/PDF):"
  read format 
  
  java -jar ~/folder/myjar.jar -input ~/scripts/file -output$format ~/output/$name.$format
  </code></pre>
  
  <p>This partially works in that it produces output file but the name variable is lost, format variable is generated in string ok.  Running this also generates the following errors: ": command not found" under hello user, " ': not a valid identifierame" after entering system name</p>