What is the syntax error in this file? I can't spot it.
set-k8s-azure() {
export KUBECONFIG=~/.kube/config.azure-1
}
set-k8s-minikube() { export KUBECONFIG=~/.kube/config.minikube }
minikube() {
if [[ $@ == start* ]]; then
set-k8s-minikube
fi
command minikube "$@"
}
alias pulr='if output=$(git status --porcelain) && [ -z "$output" ]; then git pull --rebase; else git stash save "pulr WIP saved" && git pull --rebase && git stash pop; fi'
alias vi=nvim
source ~/.bash_aliases
produces:
bash: /home/niel/.bash_aliases: line 1: syntax error near unexpected token `('
bash: /home/niel/.bash_aliases: line 1: `set-k8s-azure() { '
syntax error: unexpected end of file
(which is what I'd expect since the{ }
subshell is never closed because of the missing;
). What version of bash is this? – terdon Dec 14 '17 at 15:37GNU bash, version 4.4.12(1)-release (x86_64-unknown-linux-gnu)
and don't get the first error. – terdon Dec 14 '17 at 16:24(
if the line had whitespace in middle of the function name, likefoo bar() { ...
. But they'd need to be something the shell recognizes as whitespace. I couldn't come up with how to recreate that with invisible characters; my Bash accepts e.g. zero-width non-joiners as parts of the function name. :D – ilkkachu Dec 14 '17 at 17:26