Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Any one can help me do this with shell script:

  1. When VM startups, it checks if a folder (dbsync-installdir) exists
  2. if it does not exists, it will download the ZIP file using wget.
share|improve this question

migrated from Dec 13 '12 at 13:22

This question came from our site for professional and enthusiast programmers.

It would be interesting to know what you have tried. – Benjamin Bannier Dec 13 '12 at 10:39

To check check if a directory doesn't exist:

if [ ! -d "$DIRECTORY" ]; then
    # Here if $DIRECTORY doesn't exist.
    wget http://url_to_zip_file

To extract zip files see man unzip

Also you can check if a directory exists:

if [ -d "$DIRECTORY" ]; then
    # Here if $DIRECTORY exists.
share|improve this answer

You must log in to answer this question.