named files for archive-files
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
VERSION="20190426"
|
||||
VERSION="20250626"
|
||||
|
||||
function helpexit() {
|
||||
BS=$( basename "$0" )
|
||||
@@ -61,6 +61,7 @@ COMPRESSION=0
|
||||
SUFFIX=tar
|
||||
REMOVE=0
|
||||
YES=0
|
||||
FILES=( )
|
||||
for ((i=1; i<=${#@}; i++)) {
|
||||
[[ "${!i}" = "-h" ]] && helpexit
|
||||
[[ "${!i}" = "--help" ]] && helpexit
|
||||
@@ -68,6 +69,7 @@ for ((i=1; i<=${#@}; i++)) {
|
||||
[[ "${!i}" = "-z" ]] && { COMPRESSION=1; NOCOMPRESSION=0; COMPRESSCMD="| gzip"; SUFFIX=tgz; continue; }
|
||||
[[ "${!i}" = "--rm" ]] && { REMOVE=1; continue; }
|
||||
[[ "${!i}" = "-"* ]] && helpexit
|
||||
FILES+=( "${!i}" )
|
||||
}
|
||||
archive_name=$( basename $( pwd ) )".$SUFFIX"
|
||||
if [[ -f "$archive_name" ]]; then
|
||||
@@ -76,7 +78,12 @@ if [[ -f "$archive_name" ]]; then
|
||||
fi
|
||||
|
||||
export IFS=$'\n'
|
||||
if [[ ${#FILES[@]} -eq 0 ]]; then
|
||||
REALFILES=( $( listfiles . ) )
|
||||
else
|
||||
REALFILES=("${FILES[@]}")
|
||||
fi
|
||||
|
||||
[[ "$REMOVE" -eq 1 ]] && echo 'Source files will be deleted!'
|
||||
echo -n $S"Archive the following files to '$archive_name' "
|
||||
[[ "$NOCOMPRESSION" -eq 1 ]] && {
|
||||
|
||||
Reference in New Issue
Block a user