3

For example, I have a file look as follows:

abc
def
ghi

Now, I want to use a Linux shell script to set some variables according to this file. I need the following variables to be set something like:

export abc=abc111
export def=def111
export ghi=ghi111

As you can see that the variable names are retrieved from list file as well. Thanks.

1 Answer 1

4
while read var; do
    export $var=${var}111
done < vars.txt
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.