Your Turn

These exercises will help you build on what you learned in this chapter. They’ll help you improve your scripts, too.

  1. Add a rule to your Makefile that uses scp or rsync to transfer the files to your web server.

  2. Modify your website creation script to create a default CSS file with some basic styles.

  3. Modify your website creation script to accept a value for the site’s name and inject it into the <title> tag of the template.

  4. Use the date command to embed a copyright date in the footer of the site’s template.

  5. Combine the Makefile with the website creation script so that each new site has a templates and pages directory, as well as the Makefile.

  6. In your setup script, add code that looks for .bash_profile, backs it up, and replaces it with code that loads the .bashrc file. Use the same technique you learned in this chapter, and refer to Handling .bash_profile, for an example of what the .bash_profile file should contain. If you’re on a Mac, you can use this technique, too, instead of having the script write the ~/.bash_profile file.

  7. In your setup script, include an .inputrc file as well.

  8. Modify your setup script to install your configuration files into its own directory and create symlinks to the files instead of creating actual files.

  9. Create an isMac function to determine if you’re on macOS and use it along with your two existing scripts to create a single script for both Ubuntu and macOS. You can use the check [ "$(uname)" == "Darwin" ], which will return 0 if you’re on a Mac and 1 if you aren’t.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.205.99