According to man bash, bash identifiers may consist: "only of alphanumeric characters and underscores", however, bash seems to have been tolerant to this up until shellshock patch. Actually, it still is, but now it just throws an annoying error message. I admit that I made a stupid decision when I decided to have dots in my function naming scheme, but I have more than 100 functions named.like.this and to make things worse, I depend on that structure, because they are organized in "classes", and call each other based on that naming scheme. I am looking for a solution to suppress this error message on a global scale, because it is highly impractical to change all the function names.

my.function(){ echo hello world;}
export -f my.function
tar --help
/bin/bash: error importing function definition for `BASH_FUNC_my.function'
Usage: tar -[cxtzjhmvO] [-X FILE] [-T FILE] [-f TARFILE] [-C DIR] [FILE]...

(it complains only for exported functions, but most of them need to be exported; bash version is 4.2.37)

  • 4
    I'd suggest you take the one-time pain to fix your design error. What you are asking for is to just mask the smell with an air freshener. – glenn jackman May 6 '16 at 22:44
  • Or ignore stderr every time you export one of those functions, redirect to null... probably won't help with any actual errors though – Xen2050 May 7 '16 at 5:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.