How do I write the shebang for an application manged by update alternatives.

I installed oorexx and regina with Yast with selection by update-alternatives (openSUSE Software and openSUSE Software). There is a link at /usr/bin/rexx, but bash does not accept #!/usr/bin/rexx as a valid shebang. How do I get bash to use the currently active Rexx for a Rexx script.

linux-wbbw:~ # which.rex
bash: /usr/local/bin/which.rex: /usr/bin/rexx^M: bad interpreter: No such file or directory
linux-wbbw:~ #

I don’t have any version of “rexx” installed. It’s more than 30 years since I last used “rexx” (on a VM/CMS system).

I’m looking at the error message you are getting. That suggests to me that there is an extraneous ^M (ctrl-M or hex 0D) on the first line of that script. That’s what you would get if the script was created using a Windows editor rather than a linux editor.