bach file callign a bach file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting bach file callign a bach file
# 1  
Old 03-17-2009
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  
Old 03-17-2009
Hi,
Try to remove single quotes:
Code:
. $SCRIPT_DIR/bin/target.sh

and check script file really exists.

Albert.
# 3  
Old 03-17-2009
Quote:
Originally Posted by rambler
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. Smilie
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 08:03 PM..
# 4  
Old 03-18-2009
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How do I add a log file path to a vi file to monitor all the changes made to the file?

I'm curious to know how do I add an empty log file (test1.log) to an existing text file to monitor all the changes made to a.txt. Is this expression export PATH=$PATH:/home/test1.log right to be added to the text file a.txt? (5 Replies)
Discussion started by: TestKing
5 Replies

2. UNIX for Beginners Questions & Answers

Output file name and file contents of multiple files to a single file

I am trying to consolidate multiple information files (<hostname>.Linux.nfslist) into one file so that I can import it into Excel. I can get the file contents with cat *Linux.nfslist >> nfslist.txt. I need each line prefaced with the hostname. I am unsure how to do this. --- Post updated at... (5 Replies)
Discussion started by: Kentlee65
5 Replies

3. Shell Programming and Scripting

ksh Script, Reading A File, Grepping A File Contents In Another File

So I'm stumped. First... APOLOGIES... my work is offline in an office that has zero internet connectivity, as required by our client. If need be, I could print out my script attempts and retype them here. But on the off chance... here goes. I have a text file (file_source) of terms, each line... (3 Replies)
Discussion started by: Brusimm
3 Replies

4. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies

5. Shell Programming and Scripting

Systemd errors of missing file “No such file or directory” inspite of file being present

The contents of my service file srvtemplate-data-i4-s1.conf is Description=test service for users After=network.target local-fs.target Type=forking RemainAfterExit=no PIDFile=/data/i4/srvt.pid LimitCORE=infinity EnvironmentFile=%I . . . WantedBy=multi-user.target (0 Replies)
Discussion started by: rupeshkp728
0 Replies

6. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

7. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

8. Solaris

Before I delete any file in Unix, How can I check no open file handle is pointing to that file?

I know how to check if any file has a unix process using a file by looking at 'lsof <fullpath/filename>' command. I think using lsof is very expensive. Also to make it accurate we need to inlcude fullpath of the file. Is there another command that can tell if a file has a truely active... (12 Replies)
Discussion started by: kchinnam
12 Replies

9. UNIX for Dummies Questions & Answers

Maurice Bach

does anybody have a pdf version of Maurice Bach's "The design of the Unix Operating System" (2 Replies)
Discussion started by: areef4u
2 Replies

10. Shell Programming and Scripting

Reading file names from a file and executing the relative file from shell script

Hi How can i dynamically read files names from a list file and execute them from a single shell script. Please help its urgent Thanks in Advance (4 Replies)
Discussion started by: anushilrai
4 Replies
Login or Register to Ask a Question