How to find a parameter value using input in shell script -
i have scenario create generic script use input value , actual value config file , use further logic.
pattern.config file type1_path=/path/to/type1 type2_path=/path/to/type2
i want run script ./run.sh type1
, pattern=$1"_path"
$pattern=type1_path
. not sure how value of $type1_path
config
this bash faq 006.
specifically evaluating indirect/reference variables:
# bash realvariable=contents ref=realvariable echo "${!ref}" # prints contents of real variable # ksh93 / mksh / bash 4.3 realvariable=contents typeset -n ref=realvariable echo "${!ref} = $ref" # prints name , contents of real variable # zsh realvariable=contents ref=realvariable echo ${(p)ref} # prints contents of real variable
Comments
Post a Comment