The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help need to make a shell script run for ffmpeg vhook watermaking in shell wingchun22 Shell Programming and Scripting 1 09-27-2008 06:52 AM
Changing cursor position using shell script balamv Shell Programming and Scripting 2 06-02-2008 01:10 PM
Password changing in a Script (shell and expect) chellam Shell Programming and Scripting 1 08-14-2006 11:12 PM
What's the difference: 'nuhup cmds' Vs 'cmds &' billshu SUN Solaris 5 05-12-2004 11:01 PM
Changing korn shell script text Menu colors? darthur UNIX for Dummies Questions & Answers 6 01-20-2002 07:15 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-07-2008
charlei charlei is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 4
Smile How to run cmds after changing to a new env (shell) in a shell script

Hi,

I am using HP-UNIX.

I have a requirement as below

I have to change env twice like:

cadenv <env>
cadenv <env>
ccm start -d /dbpath
ccm tar -xvf *.tar
ccm rcv ....
mv *.tar BACKUP

but after I do the first cadenv <env> , I am unable to execute any of the later commands .

I have tried using /bin/sh -c "cmd"

but it does not seem to work. I have not sepreated these cmds by ; though. They are still seperated by newline. they look as below:


cadenv <env>
cadenv <env>
/bin/sh -c "ccm start -d /dbpath"
/bin/sh -c "ccm tar -xvf *.tar"
/bin/sh -c "ccm rcv ...."
/bin/sh -c "mv *.tar BACKUP"

can someone please help?

thanks,
Charlei
  #2 (permalink)  
Old 10-07-2008
stanleypane stanleypane is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 23
Not sure what cadenv and ccm are, but have your tried executing your commands using full paths?

sh -c "/path/to/ccm ..."

Perhaps the new environment is losing your $PATH variable?
  #3 (permalink)  
Old 10-09-2008
charlei charlei is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 4
How to run cmds after changing to a new env (shell) in a shell script

Hello Stanley
cadenv executes a script that takes it to a different environment (with its own set of variable. when I do a id command, it has an extra context value in it..)

ccm is the command to start CM syerngy from the commandline.

I have also tried the below:

.
.
(exec cadenv..; exec cadenv..;exec bsh -q qname
ccm start -d /dbpath
..

this worked once, but does not work now...


Tried as suggested by you, but does not work..

regards,
Charlei
  #4 (permalink)  
Old 10-09-2008
charlei charlei is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 4
script should read:

.
.
(exec cadenv..; exec cadenv..;exec bsh -q qname )
ccm start -d /dbpath
..
  #5 (permalink)  
Old 10-09-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,293
The script cadenv is used to set environment variables? Run the cadenv script in the current shell (source):

Code:
. ./cadenv <env>
Regards
  #6 (permalink)  
Old 10-14-2008
charlei charlei is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 4
Hi Franklin

I tried this but I get the error below

./cadenv : not found

regards,
Iniyan
  #7 (permalink)  
Old 10-14-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,293
Try:

Code:
. cadenv
or use the full path:

Code:
. /path/to/cadenv
Regards
Sponsored Links
Closed Thread

Bookmarks

Tags
running cmds from diffrent shell, unix commands

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:47 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0