#!/usr/bin/env bash # klevstul :: 26.04 this_file_name=`basename "$0"` echo "$this_file_name" # source config file src_file=/home/${USER}/syncDir/secrets/rclone/rclone.conf if ! [[ -f ${src_file} ]]; then echo "error: non-existing file '${src_file}'" >&2; exit 1 fi # target directory trg_dir=/home/${USER}/.config/rclone if ! [[ -d "$trg_dir" ]]; then echo "creating non-existing target dir '${trg_dir}'." mkdir -p ${trg_dir} fi # copy from source to target files=$(shopt -s nullglob dotglob; echo ${trg_dir}/*.conf) if (( ${#files} )) then echo "overwrite already existing *.conf file(s) in ${trg_dir}?" read -n 1 -s -r -p "press any key to continue" echo "" else echo "deploying new *.conf file(s) to ${trg_dir}" fi cp ${src_file} ${trg_dir} ls -al ${trg_dir}