If I have a simple bash function defined and exported (Mac OSX Terminal Mojave) eg
transfer-U () {
ls
}
export -f transfer-U
then my execution of Exiftool (which calls .Exiftool_config by default in my root user directory) has error messages
sh: error importing function definition for `transfer-U'
(and exiftool then goes on to process files normally)
whereas this form (no hyphen), does not.
transferU () {
ls
}
export -f transferU
Can this be reproduced?
------
My $HOME/.Exiftool_config is pretty straightforward as
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
#########
XYResolution => {
Require => {
0 => 'XResolution',
1 => 'YResolution',
},
ValueConv => q{
return $val[0]*$val[1];
},
},
FocusCalc => {
Require => {
0 => 'FocalLength',
1 => 'ShutterSpeed',
},
ValueConv => q{
return $val[0]*$val[1];
},
},
#########
},
);
#print "Loading Exiftool completed \n" ;
%Image::ExifTool::UserDefined::Options = (
RequestAll => 2, # request additional tags not normally generated
);
#print "Loading RequestAll \n" ;
#------------------------------------------------------------------------------
Proabably hyphens are not allowed in bash variable names. I'm looking for documentation to confirm this. Not sure about sh rather than bash.
See definitions section in man bash
name A word consisting only of alphanumeric characters and underscores, and
beginning with an alphabetic character or an underscore. Also
referred to as an identifier.
thanks - the bash definition works fine in normal use of .bash_aliases etc etc. Its just when exiftool is invoked (and accessing its .Exiftool_config file) that the exiftool invocation has these errors. They don't occur anywhere else. Obviously I'm happy to lose the hyphen, it just struck me as unusual.
The error appears to have come from the shell rather than from exiftool.