Call another file to run


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Call another file to run
# 1  
Old 12-13-2010
Call another file to run

Hi,

I have small script such as below
Code:
#!/bin/ksh 
while true
do
set 'date'

((profit = 0 ))
export profit

echo "\n
            1)  Setup new POS
        2)  Clear POS 
        3)  Re-set up POS

            16)  Exit

            Enter your selection : \c"
read item junk

case $item in

1)  /u/pnt/need/run1.1;;
2)  echo "choose 2";;
3)  echo " choose 3";;

16) break;;      

*) ((profit = 999));;
esac

done

run1.1 file contains
Code:
#!/bin/bash

echo "Run 1"

Problem: I can not call run1.1 on main file, please help

Last edited by phillipss; 12-13-2010 at 05:36 AM..
# 2  
Old 12-13-2010
What error u r getting?
R0H0N
# 3  
Old 12-13-2010
I had below error msg:
./main[26]: ./u/pnt/need/run1.1: not found.

But It have when I list
ls -la run1.1
-rwxrwxrwx 1 root system 26 Dec 13 10:39 run1.1
# 4  
Old 12-13-2010
Please show how do u execute your script and what standard output comes on the screen. Anyhow I have modified your script at some lines. Try this.

Code:
#!/bin/ksh

while : ; do
    set `date`
    export profit=0

    echo "\n
    1) Setup new POS
    2) Clear POS
    3) Re-set up POS

    16) Exit

    Enter your selection : \c"
    read item

    case $item in
        1) /u/pnt/need/run1.1 ;;
        2) echo "choose 2" ;;
        3) echo " choose 3" ;;

        16) exit ;;

        *) ((profit = 999)) ;;
    esac
done

R0H0N
# 5  
Old 12-13-2010
Please refer to below is my result and how I execute. It actually the same error msg.
The correct output must be show the echo on run1.1 (run1.1 just contain a text only)

/u/pnt/need:>./test1


1) Setup new POS
2) Clear POS
3) Re-set up POS

16) Exit

Enter your selection : 1
./test1[18]: /u/pnt/need/run1.1: not found.


1) Setup new POS
2) Clear POS
3) Re-set up POS

16) Exit

Enter your selection :
# 6  
Old 12-13-2010
If u enter 2 then is "choose 2" getting display? Also confirm me that what is the value of variable "profile" after u exit from test1 script. If u r looking to set the value of variable "profile" to 999 only when the value of item doesn't match any case then u should use ? instead of *.

Last edited by R0H0N; 12-13-2010 at 03:16 AM..
R0H0N
# 7  
Old 12-13-2010
ya, confirmed on choose No2, display will be "Choose 2". The value on "profit" please don't mind on it. You can remove it.
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 call variables from a file to the scripting file?

Let say I have a file with variables (Test1.txt) In Test1.txt file, it consists of Tom is a boy Jim is a dog In the other scripting file (RunTest1.sh), I have #!/bin/ksh filename = /directory/Test1.txt cat $filename for i in $filename do print $i done I managed to call... (1 Reply)
Discussion started by: TestKing
1 Replies

2. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

3. Shell Programming and Scripting

Make script that run with argument if not run from configuration file argument

Hello, Is there any method thorugh which script can take argument if pass otherwise if argument doesn't pass then it takes the argument from the configuration file i.e I am workiing on a script which will run through crontab and the script will chekout the code ,zip and copy to the... (3 Replies)
Discussion started by: rohit22hamirpur
3 Replies

4. Shell Programming and Scripting

How to call a batch file in Make file?

Hii I wanna call a batch file from a make file. Doesn't work , what is the procedure to do this.? Any idea thanks:eek: (2 Replies)
Discussion started by: krishnampkkm
2 Replies

5. Shell Programming and Scripting

howto run remotely call function from within script

Hi I have the following script : #!/bin/ksh #################### Function macAddressFinder ######################## macAddressFinder() { `ifconfig -a > ipInterfaces` `cat ipInterfaces` } ####################################################################### # # print... (2 Replies)
Discussion started by: presul
2 Replies

6. Shell Programming and Scripting

how to run script? call other script? su to another user? make a cron?

Good morning. I am searching for "how-to"'s for some particular questions: 1. How to write a script in HP-UX 11. 2. How to schedule a script. 3. How to "call" scripts from the original script. 4. How to su to another user from within a script. This is the basics of what the... (15 Replies)
Discussion started by: instant000
15 Replies

7. UNIX for Dummies Questions & Answers

How to run two commands from a exec call in a c program

Hi, I have to run two commands one after another from a c program. How can i do this with exec system calls. i tried giving them as argument to execv but it is not working.please help thanks (3 Replies)
Discussion started by: suryashikha
3 Replies

8. Infrastructure Monitoring

diffrence between method call and function call in perl

Hello, I have a problem with package and name space. require "/Mehran/DSGateEngineLib/general.pl"; use strict; sub System_Status_Main_Service_Status_Intrusion_Prevention { my %idpstatus; my @result; &General_ReadHash("/var/dsg/idp/settings",\%idpstatus); #print... (4 Replies)
Discussion started by: Zaxon
4 Replies

9. Shell Programming and Scripting

Call shell script from php not run ?

Hi. I write a shell script for import data to oracle using sql loader. I set permission 755 or 777 for that script. I can run that script in the consol okay. When I call it from PHP using system command. I got return value 126 this value when don't have permission right ? I check step... (2 Replies)
Discussion started by: raccsdl
2 Replies

10. UNIX for Advanced & Expert Users

how to differentiate system call from library call

Hi, Ho do I differentiate system call from library call? for example if I am using chmod , how do I find out if it is a system call or library call? Thanks Muru (2 Replies)
Discussion started by: muru
2 Replies
Login or Register to Ask a Question