How can I invoke a function in bash shell script
- by sufery
!/bin/bash
one_func(){
echo 'abcd'
}
echo $(one_func)
echo one_func
the end
I just wonder the distinction calling the function between $(one_function) and one_function in bash shell script.
When I set the variable "PS1" in ~/.bashrc, I can't invoke the function by one_func
e:
export PS1="\n[\e[31m]\$(one_func)" it work
export PS1="\n[\e[31m]one_func" it doesn't work