bash - Use variables with dot in unix shell script -
how use variables dot in unix (bash) shell script? have script below:
#!/bin/bash set -x "file=system.properties" file=$1 echo $1 if [ -f "$file" ]; echo "file $file exists" else echo "file $file not exist" fi
this need ⟶ x=propertyfile
, , propertyfile=$1.
can please me?
you can't declare variable names dots can use associative arrays map keys, more appropriate solution. requires bash 4.0.
declare -a file ## declare variable associative array. file[system.properties]="somefile" ## assign value. echo "${file[system.properties]}" ## access value.
Comments
Post a Comment