Finished delete_ccollect_source.sh
This commit is contained in:
parent
d7b7bab90e
commit
b267ae4cc8
1 changed files with 13 additions and 7 deletions
|
@ -26,9 +26,9 @@ _exit_err()
|
||||||
|
|
||||||
# argv
|
# argv
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
_echo "[-f] [-d] <sources to delete>"
|
_echo "${self} [-f] [-d] <sources to delete>"
|
||||||
_echo "-f: Do not ask, simply delete. Dangerous and good for sysadmins."
|
_echo " -f: Do not ask, simply delete. Dangerous and good for sysadmins."
|
||||||
_echo "-d: Also delete the destination (removes all backups)"
|
_echo " -d: Also delete the destination (removes all backups)"
|
||||||
_exit_err "Exiting."
|
_exit_err "Exiting."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -37,27 +37,33 @@ force=""
|
||||||
backups=""
|
backups=""
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
source="$1"; shift
|
|
||||||
|
|
||||||
if [ "$params_possible" ]; then
|
if [ "$params_possible" ]; then
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"-f"|"--force")
|
"-f"|"--force")
|
||||||
force=yes
|
force=yes
|
||||||
|
shift; continue
|
||||||
;;
|
;;
|
||||||
"-d"|"--destination")
|
"-d"|"--destination")
|
||||||
backups=yes
|
backups=yes
|
||||||
|
shift; continue
|
||||||
;;
|
;;
|
||||||
*)
|
--)
|
||||||
|
params_possible=""
|
||||||
|
shift; continue
|
||||||
|
;;
|
||||||
|
-*|--*)
|
||||||
_exit_err "Unknown option: $1"
|
_exit_err "Unknown option: $1"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
shift
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Reached here? So there are no more parameters.
|
# Reached here? So there are no more parameters.
|
||||||
params_possible=""
|
params_possible=""
|
||||||
|
|
||||||
|
source="$1"; shift
|
||||||
|
|
||||||
# Create
|
# Create
|
||||||
_echo "Deleting ${source} ..."
|
_echo "Deleting ${source} ..."
|
||||||
fullname="${CSOURCES}/${source}"
|
fullname="${CSOURCES}/${source}"
|
||||||
|
@ -65,7 +71,7 @@ while [ $# -gt 0 ]; do
|
||||||
# ask the user per source, if she's not forcing us
|
# ask the user per source, if she's not forcing us
|
||||||
if [ -z "$force" ]; then
|
if [ -z "$force" ]; then
|
||||||
sure=""
|
sure=""
|
||||||
_echo "Do you really want to delete ${source} (y/n)? "
|
echo -n "Do you really want to delete ${source} (y/n)? "
|
||||||
read sure
|
read sure
|
||||||
|
|
||||||
if [ "$sure" != "y" ]; then
|
if [ "$sure" != "y" ]; then
|
||||||
|
|
Loading…
Reference in a new issue