script being called from within a script.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script being called from within a script.
# 1  
Old 04-03-2008
script being called from within a script.

Greetings

I have the following 2 scripts.

If I run script devput from the commandline. everything is fine. Smilie

However I am now trying to write a wrapper script that allows me to provide a file with the files I want to devput. This doesnt work as it does not seem to recognise the parameters? Smilie

Could anyone explain why? I am doing my own head in! Smilie

mput script

#!/usr/bin/ksh
LISTFILE=$1
comments=$2
mrs=$3

tty >/dev/null

# Loop over LISTFILE
while read FILENAMEdo
devput ${mFILENAME} -y "${comments}" -m ${mrs}
done < $LISTFILE

devput

#!/usr/bin/ksh
typeset -Z6 mrs

FILENAME=$1

shift
while getopts m:y: OPTION "$@" 2>/dev/null
do
case ${OPTION} in
m) MRS=${OPTARG};;
y) COMMENTS=${OPTARG};;
*) print ${USAGE}
exit 1
esac
done

echo "FILENAME: ${FILENAME}"
echo "COMMENTS: ${COMMENTS}"
echo "MRS : ${MRS}"

Results from command line

devput listfile -y "simon test" -m 009299
FILENAME: listfile
COMMENTS: simon test
MRS : 009299

Results from mput
mput listfile "simon test" 009299
FILENAME: file2
COMMENTS: "simon
MRS :

WHY WHY WHY???? SmilieSmilie

I have been trying all day. I am sure this is simple, but I cant see the wood for the trees.

Please help a frustrated man Smilie again

Cheers
Si
# 2  
Old 04-03-2008
Hi, modify 1st script:
Code:
#!/usr/bin/ksh
LISTFILE=$1
comments=$2
mrs=$3

tty >/dev/null

# Loop over LISTFILE
while read FILENAME 
do
devput ${FILENAME} -y "${comments}" -m ${mrs}
done < $LISTFILE

# 3  
Old 04-03-2008
Cheers Clash Smilie but why is that??

Still it works I can go home with a Smilie on my face.

Nice one. really appreciate that!
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 to pass values to a script called from within another script in shell?

Ceiling Light - The Forgotten Element One of the highest details concerning using an LED ceiling panel essentially offer a fantastic dance floor which definitely makes the customers dance right away.They are a quite low cost method of something like a lighting solution, simple collection up,... (1 Reply)
Discussion started by: harveyclayton
1 Replies

2. UNIX for Beginners Questions & Answers

How to pass values to a script called from within another script in shell?

Need ideas on how to achieve the below. We have a script say "profile.sh" which internally calls another existing script called "name.sh" which prompts for the name and age of a person upon execution. When i run profile.sh how can i populate a pre-defined value from another file and pass that... (1 Reply)
Discussion started by: sankasu
1 Replies

3. Shell Programming and Scripting

Shell script to pass the config file lines as variable on the respective called function on a script

I want to make a config file which contain all the paths. i want to read the config file line by line and pass as an argument on my below function. Replace all the path with reading config path line by line and pass in respective functions. how can i achieve that? Kindly guide. ... (6 Replies)
Discussion started by: sadique.manzar
6 Replies

4. Shell Programming and Scripting

Need output of script on screen and file with correct return status of the called script.

Hi, I am trying to capture logs of the script in the file as well as on the screen. I have used exec and tee command for this. While using exec command I am getting the correct output in the file but, script output is not getting displayed on the screen as it get executed. Below is my sample... (14 Replies)
Discussion started by: Prathmesh
14 Replies

5. Shell Programming and Scripting

Passing variable from called script to the caller script

Hi all, Warm regards! I am in a difficult situation here. I have been trying to create a shell script which calls another shell script inside. Here is a simplified version of the same. Calling Script. #!/bin/ksh # want to run as a different process... (6 Replies)
Discussion started by: LoneRanger
6 Replies

6. UNIX for Dummies Questions & Answers

Calling a script from master script to get value from called script

I am trying to call a script(callingscript.sh) from a master script(masterscript.sh) to get string type value from calling script to master script. I have used scripts mentioned below. #masterscript.sh ./callingscript.sh echo $fileExist #callingscript.sh echo "The script is called"... (2 Replies)
Discussion started by: Raj Roy
2 Replies

7. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

8. Shell Programming and Scripting

Expect script called in loop from Bash Script

Having issues with an expect script. I've been scripting bash, python, etc... for a couple years now, but just started to try and use Expect. Trying to create a script that takes in some arguments, and then for now, just runs a pwd command(for testing, final will be command I pass). Here is... (0 Replies)
Discussion started by: cbo0485
0 Replies

9. Shell Programming and Scripting

How to return the value from the called shell script to the calling sh script

Hi all, I have two ksh scripts #sample1.sh #!/bin/ksh . ./sample2.sh echo $fileExist #sample2.sh #!/bin/ksh func() { i=1 return $a } func echo $? Here how should I return the value of sample2.sh back to sample1.sh? Thanks in advance. (2 Replies)
Discussion started by: gp_singh
2 Replies

10. Shell Programming and Scripting

passing a variables value from the called script to calling script using ksh

How do i get the value of the variable from the called script(script2) to the calling script(script1) in ksh ? I've given portion of the script here to explain the problem. Portion of Script 1 ============= ----- ----- tmp=`a.ksh p1 p2 p3` if then # error processing fi -----... (10 Replies)
Discussion started by: rajarkumar
10 Replies
Login or Register to Ask a Question