I want to write a bash script that automates the downloading and installing process of an app. As I test this script I don't want to download the package over and over again.

  1. Does apt-get have something similar to aptitude's dry run seen here? Or is simply commenting the apt-get install <package> and assuming it works the best bang for my buck?
  2. What about pointing apt-get install <package> to dev/null?
  3. This script will be ran on a VM is there anything I should keep in mind when writing a bash script for a VM?

1 Answer 1


apt also have dry-run. From the man-page:

-s, --simulate, --just-print, --dry-run, --recon, --no-act

No action. Perform a simulation of events that would occur but do not actually change the system. Configuration Item: APT::Get::Simulate. Simulate prints out a series of lines, each one representing an rpm operation: Configure (Conf), Remove (Remv), Unpack (Inst). Square brackets indicate broken packages with an empty set of square brackets meaning breaks that are of no consequence (rare).

So something trivially like :

apt-get -s -y install <package>
if [ $? -eq 0 ] ; then echo 'Package installed' ; else echo 'Error'; exit ; fi

Depends in what concept you want to use it.

  1. This won't install packages.

  2. As for VM, I don't see any issues.

Not the answer you're looking for? Browse other questions tagged .