>The first UniBasic command works; the second command does not... > > execute 'SH -c "pwd" ' > execute 'SH -c "cd /" ' > execute 'SH -c "pwd" ' > >UniVerse on HP-Ux comes back with... > > /u2/METAL > /u2/METAL > >Help would be appreciated.
Yeah. The "cd" command in unix basically sets an environment variable, that's all. When you "execute sh -c......" you are spawning a new process which is running a shell. It will have its own environment, and that environment will be lost when the shell process terminates and returns control back to the process that spawned it. If you want to do a series of commands, you have two choices: create an executable shell script file or put multiple commands in the -c "....". If you've got a lot of stuff you want to do in the shell, then the script file approach is best. In the example that you gave it would be easiest to just do this: execute 'SH -c "pwd" ' execute 'SH -c "cd /;pwd" ' or even: execute 'SH -c "pwd;cd /;pwd" ' The ";" separates commands to be run asynchonously within the shell process without capturing stdout from earlier commands and funnelling it into stdin for later commands. Dave Barrett Project Manager, Lawyers' Professional Indemnity Company (LAWPRO®) 250 Yonge Street, Suite 3101, P.O. Box 3 Toronto, Ontario M5B 2L7 Tel: 416-598-5872 Fax: 416-599-8341 This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please delete it and advise me (by return e-mail or otherwise) immediately. Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez le supprimer et m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen. _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users
