Re:Ask HN: Can I see your scripts?
by kakulukia on Monday August 22, 2022 @03:11AM
(#32548287)
If you are polite, it works:
alias please='sudo zsh -c "$(fc -ln -1)"' # rerun the last command with sudo (because it failed )
Easier PATH management:
# nicer path configuration and lookup
function path {
if [[ $# -eq 0 ]]; then
echo -e ${PATH//:/\\n} | sort
elif [[ "$1" == "--save" ]]; then
path $2 && echo "\npath $2" >> $HOME/.profile
else
if [[ -d "$1" ]] ; then
if [[ -z "$PATH" ]] ; then
export PATH=$1
else
export PATH=$1:$PATH
fi
else
echo "$1 does not exist :("
return 1
fi
fi
}
alias please='sudo zsh -c "$(fc -ln -1)"' # rerun the last command with sudo (because it failed )
Easier PATH management:
# nicer path configuration and lookup function path { if [[ $# -eq 0 ]]; then echo -e ${PATH//:/\\n} | sort elif [[ "$1" == "--save" ]]; then path $2 && echo "\npath $2" >> $HOME/.profile else if [[ -d "$1" ]] ; then if [[ -z "$PATH" ]] ; then export PATH=$1 else export PATH=$1:$PATH fi else echo "$1 does not exist :(" return 1 fi fi }