Bash Read Array from External File
Posted
by
jmituzas
on Stack Overflow
See other posts from Stack Overflow
or by jmituzas
Published on 2011-01-13T21:12:51Z
Indexed on
2011/01/14
2:54 UTC
Read the original article
Hit count: 196
bash
I have setup a Bash menu script that also requires user input. These inputs are wrote (appended to) a text file named var.txt like so:
input[0]='192.0.0.1'
input[1]='username'
input[2]='example.com'
input[3]='/home/newuser'
Now what I am trying to accomplish is to be able to read from var.txt from a script kinda like this:
useradd var.txt/${input[1]}
now I know that wont work just using it for an example.
Thanks in Advance, Joe
© Stack Overflow or respective owner