Bash3lper/list-app-install-apt.sh

26 lines
795 B
Bash

#!/bin/bash
# Load the list of dependencies from file.txt into an array
IFS=$'\n' read -d '' -r -a dependencies < list-app-used.txt
# Loop through the array of dependencies and check if each one is installed
for dependency in "${dependencies[@]}"
do
if ! command -v "$dependency" &> /dev/null
then
# Dependency is not installed, prompt the user to install it
echo "The $dependency dependency is not installed."
read -p "Do you want to install it now? (y/n) " choice
if [ "$choice" == "y" ]; then
sudo apt-get install "$dependency"
else
echo "Installation canceled."
exit 1
fi
else
echo "The $dependency dependency is already installed."
fi
done
echo "All dependencies are installed."