- 论坛徽章:
- 0
|
根据工具书写的代码. 怎么改都报错....
原书代码如下:
代码如下:
#!/bin/bash
shopt -s -o nounset
declare -a KEY
declare -a VALUE
declare -i k=1
while read N V
do
KEY[$k]=$N
VALUE[$k]=$V
((k++))
done<<(awk 'BEGIN{FS=": "}/\w: \w/{print $1,$2}' sapp.conf)
echo "${KEY[2]} = ${VALUE[2]}"
报错如下:
+ shopt -s -o nounset
+ declare -a KEY
+ declare -a VALUE
+ declare -i k=1
conf_load.sh: line 12: syntax error near unexpected token `('
conf_load.sh: line 12: `done<<(awk 'BEGIN{FS=": "}/\w: \w/{print $1,$2}' sapp.conf)'
补上 sapp.conf内容:
Name: Justmake
Version: 5.0
|
|