On Tue, Oct 17, 2017 at 10:32 PM, David Crayford <[email protected]>
wrote:

> On 18/10/2017 6:10 AM, Kirk Wolf wrote:
>
>> Yes, it works with bash, but the limitation with bash is that commands are
>> never local-spawned.   Therefore, you can't use DDs.
>>
>
> Yes, and that's an issue for me. I want to use bash in my shell but
> /bin/sh in COZBATCH so I can use DDnames. Are you getting the login shell
> using getpwuid()?
> Is there anyway to tell COZBATCH not to use the login shell? I can't see
> anything in the reference so I suspect not.


​I do this. My OMVS segment has /bin/sh as my shell. But I have the
following lines (mainly comments) at the very top of my ~/.profile.

# The following line will switch the process image to run the BASH
# shell if this is an interactive session and not already running
# bash.
tty -s && { ps -o args -p $$ | fgrep -q bash || exec -a -bash env bash
--login; }
​
​The above works for me when I use "ssh", "telnet", and TSO OMVS to get an
interactive shell.​ The "bash" executable is on the ${PATH} which was set
up via the /etc/profile initialization script. If yours doesn't do this,
then just put in the proper path. Hum, perhaps I should give a bit of an
explanation? Why not, I'm already blathering on.

"tty -s " returns "true" (0) if "stdin" is a terminal

&& executes the following if "tty -s" is "true". I.e. the shell session is
on a terminal

{  starts a group of commands to be executed if && says to.

"ps -o args -p $$" The "-p $$" portion says to look at the parent pid. the
"-o args" says look at its arguments.

I pipe (|) the information returned into "fgrep -q bash" which _quietly_
(no output) sets the return code to "true" if the characters "bash" are in
the arguments of the parent's command line

The || executes the next command (exec ...) only if "bash" is _NOT_ in the
parent's argument list.

"exec -a -bash env bash --login" if all the above allows it (i.e. "bash" is
not the shell being run), this is run. It replaces the current process
image with a bash login process. The "-a -bash" sets the argv[0] of the new
process image to "-bash", which by convention is what the command name is
set to for a bash login process. The "env" says to search the ${PATH} for
"bash" and run it. The "--login" is set as the argument to the new bash
process and is how you tell bash to run as a login process, so that it will
"source" all the appropriate login setup files (such as /etc/profile,
~/.bash_profile [or ~/.bash_login or ~/.profile whichever it finds in that
order])

​The above is _NOT_ executed for COZBATCH because "stdin" is not a
"terminal". Neither is it run for BPXBATCH.​



>
>
> Kirk Wolf
>> Dovetailed Technologies
>> http://dovetail.com
>>
>> On Tue, Oct 17, 2017 at 3:06 AM, David Crayford <[email protected]>
>> wrote:
>>
>> You probably already know this but COZBATCH works just fine with bash. I
>>> changed my default shell to bash and it works a treat.
>>>
>>> CoZBatch[N]: Copyright (C) 2005-2013 Dovetailed Technologies LLC. All
>>> rights reserved.
>>> CoZBatch[N]: version 3.1.0 2015-05-01
>>> CoZBatch[I]: executing progname=login-shell="-/usr/local/bin/bash"
>>>
>>>
>>> On 16/10/2017 10:46 PM, Kirk Wolf wrote:
>>>
>>> PS> CozBatch is 10 years old this year.   Its free to download and use
>>>> under our Community License.
>>>>
>>>> That's a good excuse for a party! :)
>>>
>>>
>>>
>>> On Mon, Oct 16, 2017 at 12:19 AM, David Crayford <[email protected]>
>>>> wrote:
>>>>
>>>> On 15/10/2017 10:57 PM, Kirk Wolf wrote:
>>>>
>>>>> I guess COZBATCH has left out /bin/login, and exec()s to the shell to
>>>>>
>>>>>> avoid the above restrictions.
>>>>>>>
>>>>>>> That's almost right, but COZBATCH uses spawn.  By default it will run
>>>>>>> the
>>>>>>>
>>>>>>> user's shell as a "login" shell.   The tricky part is that /bin/sh
>>>>>>> has
>>>>>>>
>>>>>> a
>>>>>> sticky bit on, so to get a local spawn you have to use one of the
>>>>>> workarounds documented in BPX1SPN
>>>>>>
>>>>>> What workaround?
>>>>>>
>>>>>
>>>>> ----------------------------------------------------------------------
>>>>> For IBM-MAIN subscribe / signoff / archive access instructions,
>>>>> send email to [email protected] with the message: INFO IBM-MAIN
>>>>>
>>>>> ----------------------------------------------------------------------
>>>>>
>>>> For IBM-MAIN subscribe / signoff / archive access instructions,
>>>> send email to [email protected] with the message: INFO IBM-MAIN
>>>>
>>>> ----------------------------------------------------------------------
>>> For IBM-MAIN subscribe / signoff / archive access instructions,
>>> send email to [email protected] with the message: INFO IBM-MAIN
>>>
>>> ----------------------------------------------------------------------
>> For IBM-MAIN subscribe / signoff / archive access instructions,
>> send email to [email protected] with the message: INFO IBM-MAIN
>>
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
>



-- 
I just child proofed my house.
But the kids still manage to get in.


Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to