osx - Replace Variable for Installer with User Input -


i have .pkg requires user input variable required install.

api_key="xxxxxxxxxxxxx" installer -pkg /prey-0.6.2-mac-batch.mpkg -target / 

the user puts api_key in quotes , installer runs fine, without fails. i've attempted make script request input variable , runs installer.

attempt 1:

#!/bin/bash  api_key="$input_api_key"  read -p "please input api key:" input_api_key  installer -pkg /prey-0.6.2-mac-batch.mpkg -target / 

attempt 2:

#!/bin/bash  read -p "please input api key:" input_api_key  api_key="$input_api_key" installer -pkg /prey-0.6.2-mac-batch.mpkg -target / 

when use api_key= in context command line spits out error saying api_key not valid command, know that. doing wrong? input appreciated :) no pun intended.

i don't why attempt 2 wouldn't work. don't see why shell try execute api_key= command there, when it's variable assignment environment of installer.

anyway, if write (equivalently attempt 2), error message give you? (this should rule out earlier one...)

#!/bin/bash read -p "please input api key:" input_api_key export api_key="$input_api_key" installer -pkg /prey-0.6.2-mac-batch.mpkg -target / 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -