select function in bash
I want to define a shell-function named "select" (can you guess what I want it for?). This is tricky because select is a shell-builtin.
I have tried something this:
function select() {
echo "select"
}
but when I try it on the command-line I get this error:
bash: syntax error near unexpected token `newline'
I have tried to turn the builtin off, but to no avail:
> enable -n select
bash: enable: select: not a shell builtin
So my 开发者_开发百科question is: How can I define a bash-function named "select"?
Many thanks!
That is a bash reserved word, so you will not be able to define any function with that name. Your error is because bash expects the rest of the normal select construction
why can't you choose another name? select is reserved for bash.
function Select(){
echo "select"
}
精彩评论