How can I invoke a function in bash shell script
Posted
by sufery
on Super User
See other posts from Super User
or by sufery
Published on 2010-04-24T20:42:21Z
Indexed on
2010/04/24
20:44 UTC
Read the original article
Hit count: 380
!/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
© Super User or respective owner