Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

rexx/regina shebang(s)

130 views
Skip to first unread message

Colin Brace

unread,
Dec 12, 2006, 12:25:31 PM12/12/06
to
Hi all,

xdg-utils is a package which developers use to identify file types. It
currently identifies Rexx files by means of the "/*" comment string in
the first line of Rexx programs which are run under OS/2 (and other
OSs?). I've opened a bug requesting that the Regina shebang,
#!/usr/bin/regina, be added to the xdg's mime database:

https://bugs.freedesktop.org/show_bug.cgi?id=9310

If there are any other Rexx shebangs in circulation, please add them
there or let me know and I will.

This issue came to my attention when I noticed that gedit (the Gnome
editor), which now includes syntax highlighting for Rexx, only
automatically switched it on for older Rexx files I had written under
OS/2, not for ones I had written or converted for use under Linux.
Wondering about this behavior, I asked on the gedit mailing list and
was pointed towards xdg.

--
Colin Brace
Amsterdam

Salvador Parra Camacho

unread,
Dec 12, 2006, 4:12:09 PM12/12/06
to

Colin Brace ha escrito:

The Open Object REXX, BRexx and Rexx/imc interpreters are called
"rexx"; the uni-REXX interpreter is called "rxx" (I think) and Regina
has two executables called "regina" and "rexx".
Ian Collier in the REXX Symposium in 1999 proposed the following
first line for portable Rexx scripts (OS/2, UNIX, mainframes):

/*bin/true;exec rexx "$0" "$@";exit # REXX */

It works fine, you only "need" to change the name and/or the
permisions of the script:

ppwizard.cmd: OS/2
ppwizard.rexx: Windows (Regina)
ppwizard.rex: Windows (Open Object REXX)
ppwizard: Linux

and then call the script:

C:\home> ppwizard /* In Windows, the extension must be in the EXTPATH
environment variable */

Best regards:

Salvador Parra Camacho

Allodoxaphobia

unread,
Dec 12, 2006, 4:44:01 PM12/12/06
to
On 12 Dec 2006 13:12:09 -0800, Salvador Parra Camacho wrote:
> Colin Brace ha escrito:

>
>> xdg-utils is a package which developers use to identify file types. It
>> currently identifies Rexx files by means of the "/*" comment string in
>> the first line of Rexx programs which are run under OS/2 (and other
>> OSs?). I've opened a bug requesting that the Regina shebang,
>> #!/usr/bin/regina, be added to the xdg's mime database:
>>
>> https://bugs.freedesktop.org/show_bug.cgi?id=9310
>>
>> If there are any other Rexx shebangs in circulation, please add them
>> there or let me know and I will.
>>
>> This issue came to my attention when I noticed that gedit (the Gnome
>> editor), which now includes syntax highlighting for Rexx, only
>> automatically switched it on for older Rexx files I had written under
>> OS/2, not for ones I had written or converted for use under Linux.
>> Wondering about this behavior, I asked on the gedit mailing list and
>> was pointed towards xdg.
>
> The Open Object REXX, BRexx and Rexx/imc interpreters are called
> "rexx"; the uni-REXX interpreter is called "rxx" (I think) and Regina
> has two executables called "regina" and "rexx".
> Ian Collier in the REXX Symposium in 1999 proposed the following
> first line for portable Rexx scripts (OS/2, UNIX, mainframes):
>
> /*bin/true;exec rexx "$0" "$@";exit # REXX */
>
> It works fine, you only "need" to change the name and/or the
> permisions of the script:
>
> ppwizard.cmd: OS/2
> ppwizard.rexx: Windows (Regina)
> ppwizard.rex: Windows (Open Object REXX)
> ppwizard: Linux
>
> and then call the script:
>
> C:\home> ppwizard /* In Windows, the extension must be in the EXTPATH
> environment variable */

Back in March, 2004 I brought this topic up in this ng.
Ian Collier replied in the thread:

From: i...@comlab.ox.ac.uk (Ian Collier)
Newsgroups: comp.lang.rexx
Subject: Re: REXX scripts on _both_ OS/2 and linux

Probably Allodoxaphobia typed into a real computer:
>I am slowly migrating from OS/2 to linux (presently MDK 9.1).
[snip]
>It's going "well" -- so far - this time - this distro.
>But, one thing nags me:
>Does anyone have any thoughts on how to have the _same_ REXX
>script source run on both machines? I am speaking, of course,
>about the "/* REXX */", and the "shebang" constructs.

You can get the Linux kernel to recognise your /* REXX */ comment using
the "binfmt_misc" feature, provided it's enabled in the kernel (and it
usually is for version 2.2.x or higher, though it might be supplied as a
module for which you have to "modprobe binfmt_misc" first).

Just execute the following (you might want to put it in an init script
so that it happens at boot time):

modprobe binfmt_misc
echo ':rexx:M:0:/*::/usr/bin/rexx:' >> /proc/sys/fs/binfmt_misc/register

This means any program starting with a Rexx comment will be executed
by /usr/bin/rexx (obviously you have to change that bit if your Rexx
interpreter is called something else). The program has to have execute
permission set, of course.

----------------------

See the whole thread:

http://groups.google.com/groups
?as_q=linux+shebang&as_ugroup=comp.lang.rexx&as_uauthors=allodoxaphobia

Or: http://tinyurl.com/y7f8k5

Jonesy
--
Marvin L Jones | jonz | W3DHJ | linux
38.24N 104.55W | @ config.com | Jonesy | OS/2
*** Killfiling google posts: <http//jonz.net/ng.htm>

Shmuel (Seymour J.) Metz

unread,
Dec 13, 2006, 10:53:53 AM12/13/06
to
In <1165944331.5...@16g2000cwy.googlegroups.com>, on
12/12/2006

at 09:25 AM, "Colin Brace" <colin...@gmail.com> said:

>If there are any other Rexx shebangs in circulation, please add them
>there or let me know and I will.

Don't forget the Open source Object REXX. I don't know the file name.

--
Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action. I reserve the
right to publicly post or ridicule any abusive E-mail. Reply to
domain Patriot dot net user shmuel+news to contact me. Do not
reply to spam...@library.lspace.org

Colin Brace

unread,
Jan 11, 2007, 8:21:56 PM1/11/07
to
On Dec 12 2006, 10:12 pm, "Salvador Parra Camacho" <spar...@gmail.com>
wrote:

> Ian Collier in the REXX Symposium in 1999 proposed the following
> first line for portable Rexx scripts (OS/2, UNIX, mainframes):
>
> /*bin/true;exec rexx "$0" "$@";exit # REXX */

I've just noticed that unfortunately this does not work on BSD; perhaps
because rexx is in a different location:

$ which rexx
/usr/local/bin/rexx

This is the error reported:

/home/colin/bin/scanmail.rex: line 1: /*bin/true: No such file or
directory

(I was trying to run one of my Rexx scripts under FreeBSD 6.1 with
ooRexx v.3.0.0 installed)

What a pity...

--
Colin Brace
Amsterdam

Patrick TJ McPhee

unread,
Jan 11, 2007, 11:48:39 PM1/11/07
to
In article <1168564916.2...@l53g2000cwa.googlegroups.com>,
Colin Brace <colin...@gmail.com> wrote:
% On Dec 12 2006, 10:12 pm, "Salvador Parra Camacho" <spar...@gmail.com>
% wrote:
%
% > Ian Collier in the REXX Symposium in 1999 proposed the following
% > first line for portable Rexx scripts (OS/2, UNIX, mainframes):
% >
% > /*bin/true;exec rexx "$0" "$@";exit # REXX */
%
% I've just noticed that unfortunately this does not work on BSD; perhaps
% because rexx is in a different location:

No, it's because "true" is in a different location.
Try
/*usr/bin/true;exec rexx "$0" "$@";exit # REXX */

If you need portability between systems which have true in /bin and
systems that have it in /usr/bin, you could try

/*/bin/true;exec rexx "$0" "$@";exit # REXX */

The key here is making /* a valid part of a unix path which results in
a no-op command.
--

Patrick TJ McPhee
North York Canada
pt...@interlog.com

Colin Brace

unread,
Jan 12, 2007, 2:30:26 PM1/12/07
to
On Jan 12, 5:48 am, p...@interlog.com (Patrick TJ McPhee) wrote:

> If you need portability between systems which have true in /bin and
> systems that have it in /usr/bin, you could try
>
> /*/bin/true;exec rexx "$0" "$@";exit # REXX */

Thanks, that works.

--
Colin Brace
Amsterdam

Ian Collier

unread,
Jan 12, 2007, 6:42:41 PM1/12/07
to
Probably Patrick TJ McPhee typed into a real computer:

>If you need portability between systems which have true in /bin and
>systems that have it in /usr/bin, you could try

> /*/bin/true;exec rexx "$0" "$@";exit # REXX */

That pattern doesn't seem to match /bin/true on Linux.
I can't think of one which would match both at once.
--
---- Ian Collier : i...@comlab.ox.ac.uk : WWW page (including REXX section):
------ http://users.comlab.ox.ac.uk/ian.collier/imc.shtml

New to this group? Answers to frequently-asked questions can be had from
http://www.rexxla.org/faq.html .

Patrick TJ McPhee

unread,
Jan 14, 2007, 10:49:49 PM1/14/07
to
In article <27803-bum...@comlab.ox.ac.uk>,
Ian Collier <i...@comlab.ox.ac.uk> wrote:
% Probably Patrick TJ McPhee typed into a real computer:
% >If you need portability between systems which have true in /bin and
% >systems that have it in /usr/bin, you could try
%
% > /*/bin/true;exec rexx "$0" "$@";exit # REXX */
%
% That pattern doesn't seem to match /bin/true on Linux.
% I can't think of one which would match both at once.

It worked for me on Fedora Core 5 (2.6.15-1.2054_FC5smp), where
/bin/sh is bash 3.1.7(1)-release.

Ian Collier

unread,
Jan 15, 2007, 7:23:54 AM1/15/07
to
Probably Patrick TJ McPhee typed into a real computer:
>% > /*/bin/true;exec rexx "$0" "$@";exit # REXX */

>It worked for me on Fedora Core 5 (2.6.15-1.2054_FC5smp), where
>/bin/sh is bash 3.1.7(1)-release.

How odd.

$ cat /etc/fedora-release
Fedora Core release 5 (Bordeaux)
$ uname -r
2.6.18-1.2200.fc5smp
$ rpm -q bash
bash-3.1-9.fc5.1
$ echo /*/bin/true
/*/bin/true

On this system if I execute a program starting with the above line
it says "[prog]: line 1: /*/bin/true: No such file or directory"
before running it.

Colin Brace

unread,
Jan 20, 2007, 11:35:44 PM1/20/07
to
I've encountered another quirk with this shebang.

I am trying to run a script as a crontab on by FreeBSD box. When cron
tries to execute the script, it returns an error message:

exec: rexx: not found

even though rexx is most definitely in the path:

# which rexx
/usr/local/bin/rexx

--
Colin Brace
Amsterdam

Ian Collier

unread,
Jan 22, 2007, 9:57:10 AM1/22/07
to
Colin Brace <colin...@gmail.com> told comp.lang.rexx:

>exec: rexx: not found

># which rexx
>/usr/local/bin/rexx

It sounds like the PATH for crontab jobs isn't the same as your interactive
path. You may have to specify one in the crontab file if your version of
cron allows.

Allodoxaphobia

unread,
Jan 22, 2007, 2:22:17 PM1/22/07
to
On Mon, 22 Jan 2007 14:57:10 +0000 (UTC), Ian Collier wrote:
> Colin Brace <colin...@gmail.com> told comp.lang.rexx:
>>I've encountered another quirk with this shebang.
>
>>I am trying to run a script as a crontab on by FreeBSD box. When cron
>>tries to execute the script, it returns an error message:
>
>>exec: rexx: not found
>
>>even though rexx is most definitely in the path:
>
>># which rexx
>>/usr/local/bin/rexx
>
> It sounds like the PATH for crontab jobs isn't the same as your interactive
> path. You may have to specify one in the crontab file if your version of
> cron allows.

Or, a logical link (`ln`) from somewhere in crontab's PATH to the 'real'
REXX -- if you have those permissions.

Jonesy
--
Marvin L Jones | jonz | W3DHJ | linux
38.24N 104.55W | @ config.com | Jonesy | OS/2

*** Killfiling google posts: <http://jonz.net/ng.htm>

0 new messages