[OT] Shell scripting compatibility

Jacob Carlborg doob at me.com
Sun Jul 5 03:22:34 PDT 2009


On 7/5/09 6:36 AM, Nick Sabalausky wrote:
> "Adam D. Ruppe"<destructionator at gmail.com>  wrote in message
> news:mailman.5.1246741099.14071.digitalmars-d at puremagic.com...
>> On Sat, Jul 04, 2009 at 04:50:22PM -0400, Nick Sabalausky wrote:
>>> Can /bin/bash safely be expected to exist on all non-Windows systems that
>>> can compile D? Or is there something better for that? Any common
>>> cross-platform-scripting gotcha's to be aware of?
>> I know on FreeBSD it is often in /usr/local/bin/bash (if it is installed
>> at
>> all), so you can't really rely on it being at /bin/bash.
>>
>> I don't really have a solution to cover the differences though. I guess
>> you could write simple, minimal scripts and just use /bin/sh for best
>> cross platform luck.
>>
>
> That may work just fine in my case. I'm just using a batch-file (win) and a
> shell script (non-win) to launch rebuild to compile the real cross-platform,
> umm "script", that's written in D. And even then, only for the cases where
> the included precompiled versions are insufficient, such as on a non-x86 or
> a mac (my only mac isn't current anymore. and it's completely dead.). So it
> is fairly trivial script.
>
> So sh is typically in that location then? I know Unix doesn't really have a
> way (at least to my knowledge) to handle a script needing a particular
> interpreter that could be in different places on different machines without
> requiring the user to make a symlink or something. But I don't really need
> perfect. Good enough is good enough here :)
>
>

#!/usr/bin/env bash

but that requires env, I don't know if that's any better.



More information about the Digitalmars-d mailing list