Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 02-10-2008, 12:28 PM   #1
LQ Newbie
Registered: Feb 2008
Posts: 2

Rep: Reputation: 0
Angry How to execute commands within a subshell opened by another command?

I am trying to copy files stored in the clearcase, using a shell script.
In order to do this i need to logon as a user other than root and set the view with cleartool command:
su - <user> -c "cleartool setview <viewname>"

The problem is that now i need to access the files within this view, however the setview command opens a new shell and i can't seem to execute any commands within this shell. I've tried a number of options but no luck. Any attempt to access the files in the view results in an error saying that the files do not exist (meaning that the view was set and the shell opened by that command has closed by the time i was trying to access the files in the view, and back in the current shell those files are really non accessible, since there's no view set).

I'd really appreciate any suggestions,

Old 02-10-2008, 03:31 PM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 679Reputation: 679Reputation: 679Reputation: 679Reputation: 679Reputation: 679
Can you first su to the user and then enter individual cleartool commands:
su - <user>
cleartool <subcommand>
cleartool <subcommand2>
cleartool <subcommand3>
Old 02-10-2008, 11:03 PM   #3
Registered: Sep 2003
Location: Raleigh, NC, USA
Distribution: Fedora
Posts: 88

Rep: Reputation: 16
You can do this, but you have to do things a little bit differently. It has been a couple of years since I have used clearcase, but I remember having to deal with this. I think cleartool has a startview command (or something like that) that starts the view. This command does not start a new shell. To actually see the files in the view, you actually look in a different filesystem. On our systems there would be a directory like /views/<view name>/ that would let you see the files in the view. I don't know if that is a typical location or something specials our admins had configured. Hopefully, this is enough to get you on the right path.
Old 02-11-2008, 09:19 AM   #4
LQ Newbie
Registered: Feb 2008
Posts: 2

Original Poster
Rep: Reputation: 0
thanks the startview thing worked just fine


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Execute different commands at startup lucazorzi Linux - General 7 11-02-2007 08:46 AM
tcsh How to execute foreach in subshell? kaz2100 Programming 1 07-07-2007 08:10 AM
Shell won't execute commands.... frank320 Red Hat 6 03-17-2006 12:12 PM
Using FTP to execute command line commands remotely steve_2010 Solaris / OpenSolaris 4 02-13-2004 09:44 AM
how to execute commands on login k4zau Linux - Software 3 10-12-2003 02:52 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:29 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration