Jeg vil gerne have bygget valgmuligheder ind i et script, sådan at man kan vælge Y/N ved f.eks.:
Kode: Vælg alt
echo "Tilføjelser af softwarekilder."
echo ""
echo "EN ELLER ANDEN ADVARSEL, OM AT LISTEN OVERSKRIVES VED JA"
echo "Vil du overskrive listen?. y/n"
if [[ `INPUT FRA Y/N` == 'y' ]];
then
echo "deb http://archive.canonical.com/ubuntu/ $(lsb_release -cs) partner" > /etc/apt/sources.list
echo "deb http://archive.canonical.com/ubuntu/ $(lsb_release -cs)-updates partner" >> /etc/apt/sources.list
echo "deb http://dk.archive.ubuntu.com/ubuntu/ $(lsb_release -cs) multiverse" >> /etc/apt/sources.list
echo "deb http://dk.archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-updates multiverse" >> /etc/apt/sources.list
echo "deb http://dk.archive.ubuntu.com/ubuntu/ $(lsb_release -cs) main restricted" >> /etc/apt/sources.list
echo "deb http://dk.archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-updates main restricted" >> /etc/apt/sources.list
echo "deb http://dk.archive.ubuntu.com/ubuntu/ $(lsb_release -cs) universe" >> /etc/apt/sources.list
echo "deb http://dk.archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-updates universe" >> /etc/apt/sources.list
sudo apt-get update -y
echo ""
echo "Udført.
else
echo "Tilføjelser af softwarekilder blev fravalgt."
fi
Da scriptet jo fortsætter, skal valget kun give indflydelse på de viste linier, og derefter skal det bare kører videre. Nogle gode ideer?