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