0

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?

Alperen Elhan
  • 352
  • 2
  • 5
  • 15

1 Answers1

2

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
$ 
Michael Krelin - hacker
  • 122,635
  • 21
  • 184
  • 169