Skip to content

Commit a2941e6

Browse files
authored
PASSWORDLESS_SUDO
1 parent 01e0c32 commit a2941e6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Linux/.bashrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ export BASH_IS_INTERACTIVE="0"
2020
case $- in
2121
*i*) export BASH_IS_INTERACTIVE="1";;
2222
esac
23+
##Is Passwordless?
24+
if sudo -n true 2>/dev/null; then
25+
export PASSWORDLESS_SUDO="1"
26+
else
27+
export PASSWORDLESS_SUDO="0"
28+
fi
2329
##Apperance
2430
if [[ "$(tput colors 2>/dev/null | tr -d '[:space:]')" -eq 256 ]]; then
2531
export TERM="xterm-256color"
@@ -311,6 +317,7 @@ export PATH
311317
##FZF
312318
if [[ "${NO_FZF}" != 1 ]]; then
313319
if sudo -n true 2>/dev/null; then
320+
if [[ "${PASSWORDLESS_SUDO}" == 1 ]]; then
314321
if command -v batcat &>/dev/null && ! command -v bat &>/dev/null; then
315322
sudo ln -s "$(realpath $(command -v batcat))" "${HOME}/.local/bin/bat"
316323
fi

0 commit comments

Comments
 (0)