I tried to use activitycount via .quit ACTIVITYCO
I get the right answer 5439 on standard output:
*** You are now logged off from the DBC.
*** Exiting BTEQ...
*** RC (return code) = 5439
but how canI let know the invoking shellscript the activitycount?
Since only the low-order byte will get passed to the shell script, Return Code / Exit code isn't a good method.
You can parse the BTEQ stdout to obtain the activity count. Or write a Notify Exit, have BTEQ pass the value to the exit, and have the exit write it to a file which the shell reads.
Or use something other than BTEQ, e.g. there are Teradata drivers available for use with Perl and Python specificially, as well as standard ODBC, JDBC, and .NET drivers.