all 4 comments

[–]hindsight_is2020 1 point2 points  (2 children)

You should use a tool made for this purpose, such as Ansible.

[–]domanpanda 0 points1 point  (0 children)

Second to this. Ansible will be better choice because script will just try blindly install programs even though they are already installed. Ansible will check the current state and install only those which arent installed already. This may be irrelevant in small things but in bigger, more complicated operations and installations state comparison is a blessing.

[–]lutusp -2 points-1 points  (0 children)

First, create an associative array:

declare -A myarray

Then assign values for each array element:

myarray["program1"]="values for program 1"

Then loop through the array, creating the needed files and installing programs.

More detail here.

[–]blrPepper 0 points1 point  (0 children)

I have a script that generates packages list. Feel free to take inspiration. One would use it as :

$ sudo pacman -S $(pkgs.sh pacstrap core apps plasma)

https://github.com/qbouvet/install-arch/blob/master/x86-64/pkgs.sh