I have a script made and I am trying ot move the variable to separate file and parse it to the script, but it does not work as expected, is there any suggestion on how to get this done?
Sample code, do you mean you want to store variables into a file and then reparse/read it back? Generally, Unix scripts do not this because of issues with locking and synchronization with simultaneous runs.
Give us an example, please.
What you stated is precisely what I wanted to do, I am not really sure of how to do it, I have tried the while read line routine parsing the input of the variable from the end of file, but it was spewing out the worng feed back from a very good working script.
I have seeing it done a couple of places, but I just do nto know how.
from your two posts in this thread I still don't understand what you are trying to do. Could you explain a bit more?
I guess that you might want what in your shell man pages is described as the builtins with names . or source. Details will depend on what shell you actually are using; you didn't tell us.
This is for a rather static list of variables. If you want to change your variables dynamically at runtime, then there will be a lot of problems. And elgrandeperro seems to have assumed the latter. (Sorry if I misunderstood!)
data() {
set -A array $(<file2)
A=${array[0]}
B=${array[1]}
C=...........
}
Mike
"Whenever I dwell for any length of time on my own shortcomings, they gradually begin to seem mild, harmless, rather engaging little things, not at all like the staring defects in other people's characters."
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.