[comp.unix.shell] % /bin/sh -c /bin/ls -l -R ???

rudrak@saphir.cl.bull.fr (Rudrakshala Purushotham) (11/16/90)

I want run the command in subject from c-shell prompt. The problem is 
it goes through .login and runs /bin/ls only. 
I tried 

% /bin/sh -c "/bin/ls -l -R"

it works as expected. What are the other ways of doing this. How does 
shell escape functions handle this in a C program using execv () ?

Thanks for any help in advance.

-- Purush


-- 
R. Purushotham                          Email: rudrak@saphir.cl.bull.fr
F7 1 D5 BULL SA                         Tel Off: 34627000 ext 3928
78340 Les Clayes sous Bois  FRANCE      Tel Res: 34604752
=======================================================================

andyc@bucky.intel.com (Andy Crump) (11/29/90)

>>>>> On 16 Nov 90 10:19:00 GMT, rudrak@saphir.cl.bull.fr (Rudrakshala Purushotham) said:
Rudrakshala> Originator: rudrak@saphir

Rudrakshala> I want run the command in subject from c-shell prompt. The problem is 
Rudrakshala> it goes through .login and runs /bin/ls only. 
Rudrakshala> I tried 

Rudrakshala> % /bin/sh -c "/bin/ls -l -R"


I don't believe .profile is invoked when /bin/sh -c is used.  Only at
login if argv[0] is "-sh".  I tried this under csh on Sun OS, and
Intel System V Release 4 version 2.0 and had no problem getting it to
recognize the -l -R options.  

Rudrakshala> it works as expected. What are the other ways of doing this. How does 
Rudrakshala> shell escape functions handle this in a C program using execv () ?

The C program can call system(), which essentially does the same thing
or if using execv(), they will build up the argv vector and pass it to
execv().
--

    -- Andy Crump

    ...!tektronix!reed!littlei!andyc | andyc@littlei.intel.com
    ...!uunet!littlei!andyc          | andyc@littlei.uu.net

Disclaimer: Any opinions expressed here are my own and 
            not representive of Intel Corportation.