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
IF condition failing in a SSH script rubionis Shell Programming and Scripting 9 11-21-2007 04:17 PM
here document to automate perl script that call script hogger84 Shell Programming and Scripting 3 10-22-2007 10:15 AM
How to call a perl script from a shell script anumkoshy Shell Programming and Scripting 2 08-30-2007 04:23 AM
UNIX script failing .... khan1978 UNIX for Advanced & Expert Users 1 12-05-2005 01:28 PM
Embedded SQL in AWK script 2nilotpal Shell Programming and Scripting 2 04-21-2004 04:33 PM

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

Join Date: Jun 2008
Posts: 2
csh failing to call an 2 embedded csh script

I have an extraordinary problem with a csh script.....(feel free to berate the use of this but I'm modifying an existing bunch of them)

Anyway, I have a master csh script which in turn calls a second csh script. This second csh script is below. Within this second script are two compiled C++ programs that are called to perform two different tasks.

Code:
#!/bin/csh

# This script is set up to execute in the directory it is called from 
# (ie. The ${PAT_ID} variable is actually = DIAP_xCM_LES_yyMM/wi/ANG) 

if ( ${#argv} == 0 ) then
   echo " Please input gantry angle (format = 000) "
   exit 1
endif


set ANG=${1}

foreach t ( 0 2 4 6 8 ) # so t1 will be set to values of 1,2,3,4,5
 
  set t1=`echo " scale=0; ( $t + 2 ) / 2" | bc -l`                         
  echo " Mapping dose cube ${t1}... " 

  # Perform the defomation of the dose cubes for each phase using the NCAT deformation vectors and function NCAT_2_MCdose
  /scratch5/jseco/bin/NCAT_2_MCdose /scratch5/jseco/DPM/NCAT/DEFORMATION_VECTORS/ncat_diap_1cm_ph${t1}to1_vec.dat ${ANG}_ph${t1}_w1_H2O.3ddose 256 256 256 1 0
  mv dose_out.3ddose ${ANG}_ph${t1}to1_mapped.3ddose
  rm ${ANG}_ph${t1}_w1_H2O.3ddose
  
end

# add the mapped dose cubes together to get a total dose cube for this beam
echo " Adding mapped dose cubes for angle ${ANG}... "
/scratch5/jseco/..../add_dose_joao_weighted ${ANG}_total_mapped.3ddose ${ANG}_ph?to1_mapped.3ddose 0.2 0.2 0.2 0.2 0.2 

# get rid of mapped dose cubes so only dose cube left for this run is the total for this beam and move it into the run directory to sum
#rm ${ANG}_ph*to1_mapped.3ddose


The problem is that only part of the script is being executed. The 'foreach' loop is completed without fail and does exactly what it is supposed too - calls the NCAT_2_MCdose C++ function (which is an image deformation type program). This tells me that the parent script is calling the second script correctly. However, when it attempts to execute the next line of

/scratch5/jseco/...../add_dose_joao_weighted ${ANG}_total_mapped.3ddose ....

it fails. This function has execution permission and the path is correct. Now for the truly strange part. When I run the second script with these two C++ functions in it from the command line it executes perfectly. However, executing it from the parent (first script) only performs the foreach loop and the second program isn't even called (I can't even get any stout or sterr output to be written using the 1> and 2> redirection options.

Is there any suggestions to resolve this? I've spent 2 straight days on this and have finally conceded that I don't know enough and would really appreciate a fresh outlook on this.

Edit: I should add, this second function takes 5 files (with naming convention ${ANG}_ph1to1_mapped.3ddose) and adds them together, each with a weighting of 0.2 with the result being output in the ${ANG}_total_mapped.3ddose. Again, this command works flawlessly when used separately on the command line, or by running this script independently from the parent program.

Last edited by pollsizer; 06-06-2008 at 10:37 PM..
  #2 (permalink)  
Old 06-07-2008
pollsizer pollsizer is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 2
Update:

So, it turns out that the executable that was failing is a symbolic link to the real executable located on another disk on our cluster. This symbolic link and the real exe still had full read,write and exec permissions so I'm not sure why this didn't work.

However, end of story - copying the exe to the disk that I was calling it from fixes the problem.
Closed Thread

Bookmarks

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 09:32 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