This shows you the differences between two versions of the page.
archive_file_to_path_and_prepare_for_edit [2009/06/04 15:12] k2patel created |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== archive file to path and prepare for edit==== | ||
- | <code bash | 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 | ||
- | </code> |