how to read a file in bash and store it in an array.

preview_player
Показать описание
Taken from the instagram livestream on 2024-11-08

🔗 More Links

📖 Keywords
you suck at programming #programming
#devops #bash #linux #unix #software #terminal #shellscripting #tech #stem
Рекомендации по теме
Комментарии
Автор

You never really answered the question lol. It would look something like this:

declare -a lines
while IFS= read -r line; do
lines+=("$line")
done < "$file"

That will read each line of a file into an array.

FkDJT-uthm
Автор

forgive my ignorance, but what language is this? 🤔

Andrea-tjv
Автор

I don't think that answered the question. Yout solution is oddly specific.

That would have been my thought if i asked that question

theycallmesloth
Автор

Why would you make the assumption that the file only has one line and then give solution that only works for that ? At least a solution for a multi line file would still work for a single line file

geteducatedyoufool
join shbcf.ru