0

I have file test.txt contains the following

AA=testing
BB=help
CC=hello

How can i make a bash script that will get each value and assign to a new variable?

#!/bin/bash

var1=testing
var2=help
var3=hello

thanks for the help

1 Answers1

0

First of all a = value is not correct syntax in shell. In shell the spaces are important.

When you have a valid file, you can use the eval function to evaluate that file as a string, or simply source it.

alinsoar
  • 15,386
  • 4
  • 57
  • 74