Oh all right. I’ve figured it out by myself. The answer is to find an app to invoke that particular file type, associate that app with the corresponding file extension in Finder, then create the link by selecting the file in Finder.
Here’s how to invoke ipnyb files:
https://stackoverflow.com/questions/47267932/associate-ipynb-files-with-jupyter-notebook-in-windows-10-anaconda . I installed nbopen, then created an nbopen.app using automator. The bash script in automator’s ‘Run Shell Script’ was:
nohup <my home directory>/anaconda3/bin/nbopen "$@"
And yes, it’s a bit flaky, but most of the time it works…
Actually, of course, the real answer to my question was “use automator to create an app that runs the shell script, then associate that app with the file extension”. Sounds complicated, but takes ten minutes or less!