1
0
Fork 0
mirror of https://github.com/zdharma-continuum/zinit-configs.git synced 2025-01-31 04:08:16 +01:00
zinit-configs/NICHOLAS85/zinit/snippets/config/patches/rm-trash.patch
vladislav doster 92f7b7ff82
maint: normalize configuration file names to be "zshrc" (#11)
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2022-06-04 07:40:14 -05:00

50 lines
1.1 KiB
Diff

Don't run on sudo, Fix arg handling
--- nateshmbhat---rm-trash/rm-trash/rm-trash 2020-05-22 20:42:16.267371553 -0400
+++ nateshmbhat---rm-trash/rm-trash/rm-trash-patch 2020-05-22 20:42:13.677459148 -0400
@@ -1,4 +1,5 @@
#!/bin/bash
+[[ $EUID = 0 ]] && { echo "Root detected, running builtin rm"; command rm ${rm_opts} "${@}"; exit; }
# MIT License
@@ -238,7 +239,7 @@
LOOPENTERFLAG=0
- for file in ${FILE_ARGS[@]}
+ for file in "${FILE_ARGS[@]}"
do
LOOPENTERFLAG=1
if [ $DEBUGFLAG -eq 1 ] ; then
@@ -273,7 +274,7 @@
exit 1
fi
- for arg in $@ ; do
+ for arg in "$@" ; do
if [ "${arg:0:1}" == '-' ] ; then
if [ "$arg" == "--no-trash" ] ;then
@@ -283,7 +284,7 @@
OPTIONAL_ARGS+=($arg)
else
- FILE_ARGS+=($arg)
+ FILE_ARGS+=("$arg")
fi
case "$arg" in
@@ -318,10 +319,10 @@
-handleArguments $@
+handleArguments "$@"
if [ $DEBUGFLAG -eq 1 ] ;then
echo ${OPTIONAL_ARGS[@]}
echo ${FILE_ARGS[@]}
fi
-main $@
\ No newline at end of file
+main $@