The UNIX and Linux Forums  


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
Need help with awk - how to read a content of a file from every file from file list tanit Shell Programming and Scripting 7 03-10-2009 05:19 AM
file size comparision local file and remote file dba.admin2008 Shell Programming and Scripting 4 11-13-2008 05:57 PM
Reading a file and writing the file name to a param file. thebeginer UNIX for Advanced & Expert Users 1 10-05-2007 05:38 PM
Maurice Bach areef4u UNIX for Dummies Questions & Answers 2 08-01-2006 01:01 AM
Reading file names from a file and executing the relative file from shell script anushilrai Shell Programming and Scripting 4 03-10-2006 05:25 AM

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 03-17-2009
rambler rambler is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 10
bach file callign a bach file

Hi all
i want to write a ksh file that can be able to get a path directory and execute an other bach file

my scripte semm like that


Code:
#!/bin/ksh

ENV_ID=$1
WORK_DIR=${PWD%/bin}

#definition de la variable d'environement de la derniere version ECX
SUBDIR=`ls $WORK_DIR/| grep "ecx-batch-1" | tail -1`

SCRIPT_DIR="$WORK_DIR/$SUBDIR"

#echo : that put the right path OK !!!!
echo $SCRIPT_DIR  

. `$SCRIPT_DIR`/bin/target.sh

the last line get me an error like :
myScript.ksh[14]: path_name: cannot execute
myScript.ksh[14]: /bin/target.sh: not found

thank you in advance
  #2 (permalink)  
Old 03-17-2009
AlbertGM AlbertGM is offline
Registered User
  
 

Join Date: Mar 2009
Location: Barcelona - Catalonia
Posts: 28
Hi,
Try to remove single quotes:

Code:
. $SCRIPT_DIR/bin/target.sh

and check script file really exists.

Albert.
  #3 (permalink)  
Old 03-17-2009
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,365
Quote:
Originally Posted by rambler View Post
Hi all
i want to write a ksh file that can be able to get a path directory and execute an other bach file

A bach file? I use mplayer.
Quote:

my scripte semm like that


Code:
#!/bin/ksh

ENV_ID=$1
WORK_DIR=${PWD%/bin}

#definition de la variable d'environement de la derniere version ECX
SUBDIR=`ls $WORK_DIR/| grep "ecx-batch-1" | tail -1`

Why grep?


Code:
SUBDIR=`ls $WORK_DIR/*ecx-batch-1* | tail -n 1`

Quote:

Code:
SCRIPT_DIR="$WORK_DIR/$SUBDIR"

#echo : that put the right path OK !!!!
echo $SCRIPT_DIR  

. `$SCRIPT_DIR`/bin/target.sh


Code:
. "$SCRIPT_DIR"/bin/target.sh


Last edited by cfajohnson; 03-17-2009 at 07:03 PM..
  #4 (permalink)  
Old 03-18-2009
rambler rambler is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 10
Thank you cfajohnson and AlbertGM
it's ok when i use . $PATH_NAME or . "$PATH_NAME/bin/finename.sh"

cfajohnson i use the grep to retrive the lastest directory (include version) that contain the bash file in need to execute, now we are on 11.0.1 version
i know that grep is not very good, then who i can get the last directory ( the recent) which name begfin "batch-xx"


thank you in advance
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 08:49 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