Reputation: 410
I have a string that parses files. But when i execute it. It gives an error. Here is the code;
config="/tmp/files.config"
tftp $TFTP_SERVER_IP -c get "files.config" "$config"
while read line
do
IFS='=' read -a current_line <<< "$line"
tftp $TFTP_SERVER_IP -c "${current_line[0]}" "${current_line[1]}"
done < "$config"
Here is the error;
line 6: syntax error: unexpected redirection
How can i fix this?
Upvotes: 0
Views: 838
Reputation: 143249
maybe
tftp $TPTP_SERVER_IP -c "${line#*=}" "${line%=*}"
(that is — instead of the whole while
body).
$ ash
$ line="asdasdsad=123123123123"
$ echo $line
asdasdsad=123123123123
$ echo ${line%=*}
asdasdsad
$ echo ${line#*=}
123123123123
$
Upvotes: 2