Files
bash/tests/func5.sub
T

83 lines
1.5 KiB
Plaintext

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# these are ok
function a=2
{
printf "FUNCNAME: %s\n" $FUNCNAME
}
function 11111
{
printf "FUNCNAME: %s\n" $FUNCNAME
}
# but this is still not
function sys$read
{
printf "FUNCNAME: %s\n" $FUNCNAME
}
declare -f
set -o posix
declare -f
set +o posix
a\=2
<(:) ()
{
echo $FUNCNAME
}
\<\(:\)
type '<(:)'
break()
{
echo FUNCNAME: $FUNCNAME
}
type break
\break
# you can print them in posix mode
set -o posix
# posix mode should find special builtins first
type break
declare -F break
set +o posix
unset -f break
# but in posix mode, declaring such a function is a fatal error
( set -o posix
break()
{
echo FUNCNAME: $FUNCNAME
}
echo after
)
# in posix mode, functions whose names are invalid identifiers are fatal errors
( set -o posix
!! () { fc -s "$@" ; }
type \!\!
)
# but you can create such functions and print them in posix mode
!! () { fc -s "$@" ; }
type '!!'
set -o posix
type '!!'
set +o posix