On Sat, 4 Mar 2023 at 19:30, Ken Young <ken@highwinds.cloud> wrote: > Do you know why my alias can't work in the bash script? > The info is as follows. > > 1) this alias does exist > $ alias |grep 'k=' > alias k='minikube kubectl --' > > 2) it also exists in .bash_profile > $ cat ~/.bash_profile |grep 'k=' > alias k="minikube kubectl --"
[...] > ./get.sh: line 5: k: command not found [...] > Please give suggestions. Hi. Friends don't help friends to do bad things :) Debian's default shell is 'dash'. Its manual, readable using 'man dash', says Aliases provide a convenient way for naive users to create shorthands for commands without having to learn how to create functions with arguments. They can also be used to create lexically obscure code. This use is discouraged To achieve your goal, do this instead. In .bash_profile, replace the line alias k='minikube kubectl --' with these two lines: k() { minikube kubectl "$@" ; } export k