Backing-up with scripts

Now that we have created some scripts, we may want to back these up to a different location. If we create a script to prompt us, we can choose the location and the type of files that we want to backup.

Consider the following script for your first practice. Create the script and name it $HOME/backup.sh:

#!/bin/bash# Author: @theurbanpenguin# Web: www.theurbapenguin.com# Script to prompt to back up files and location# The files will be search on from the user's home# directory and can only be backed up to a directory# within $HOME# Last Edited: July 4 2015read -p "Which file types do you want to backup " file_suffixread -p "Which directory do you want to backup to " dir_name# The next lines creates the directory if it ...

Get Mastering Linux Shell Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.