Skip to content

Instantly share code, notes, and snippets.

@LordShedy
Created May 10, 2020 14:10
Show Gist options
  • Save LordShedy/b3e43dae16fcd65784044d2c4cf1f9f0 to your computer and use it in GitHub Desktop.
Save LordShedy/b3e43dae16fcd65784044d2c4cf1f9f0 to your computer and use it in GitHub Desktop.
function bk() {
if [[ -z $1 ]]; then
echo "Please, enter a path to a file to create the backup file of!"
else
local __path=${1}
local __timestamp=`date +'%Y%m%d%H%M'`
local __backup_file="${__path}.${__timestamp}.bk"
[[ -f "${__path}" ]] && cp "${__path}" "${__backup_file}"
echo "File "$1" was backed up as ${__backup_file}"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment