User Tools

Site Tools


archive_file_to_path_and_prepare_for_edit

This is an old revision of the document!


archive file to path and prepare for edit

| archive.sh
#!/bin/bash
# jt powered
 
cmd=$(basename $0)
dt=$(/bin/date +%Y%m%d-%H%M)
int="jt"
archdir="archive/"
 
if [ $# -lt 1 ]; then
        cmd=$(basename $0)
        echo "Usage: $cmd <filename>"
        exit 1
fi
 
        if cp -p "$1" "$archdir$1.$dt.$int"
        then
                ls -l "$archdir$1.$dt.$int"
                read -p "Press enter to begin edit" 
                vim "$1"
        else
        echo "$cmd quitting: can't make backup?" 1>&2
        fi
archive_file_to_path_and_prepare_for_edit.1244128355.txt.gz ยท Last modified: 2020/08/10 02:28 (external edit)