confirm is broken
This commit is contained in:
parent
acd2a741b1
commit
e0575fce85
18
.zshrc
18
.zshrc
|
@ -46,7 +46,7 @@ alias rg="rg --no-ignore"
|
|||
alias home="cd $HOME"
|
||||
alias ff=firefox
|
||||
alias fd=fdfind
|
||||
alias shutdown="confirm shutdown"
|
||||
# alias shutdown="confirm shutdown"
|
||||
|
||||
### Functions
|
||||
function largefiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(G|T|P|E)\s" }
|
||||
|
@ -98,13 +98,14 @@ fi
|
|||
return $ret
|
||||
}
|
||||
function confirm() {
|
||||
echo "To be executed: $@"
|
||||
read -p "Confirm (Y/N): " -n 1 -r
|
||||
case "$REPLY" in
|
||||
y|Y ) echo "es"; eval $@;;
|
||||
n|N ) echo "o";;
|
||||
* ) echo -e "\ninvalid";;
|
||||
esac
|
||||
bash -c "
|
||||
echo \"To be executed: $@\";
|
||||
read -p \"Confirm (Y/N): \" -n 1 -r;
|
||||
case \"\$REPLY\" in
|
||||
y|Y ) echo \"es\"; eval $@;;
|
||||
n|N ) echo \"o\";;
|
||||
* ) echo -e \"\ninvalid\";;
|
||||
esac" $@
|
||||
}
|
||||
function confirm-important() {
|
||||
echo "Write 'yes do as i say' to confirm that you REALLY want to do this: $@"
|
||||
|
@ -117,6 +118,7 @@ function confirm-important() {
|
|||
fi
|
||||
}
|
||||
|
||||
|
||||
### ---- zsh options -------------------------------------
|
||||
setopt autocd
|
||||
setopt HIST_FIND_NO_DUPS
|
||||
|
|
Loading…
Reference in New Issue