- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Calling Function in another Script
Operating System - HP-UX
1748123
Members
3428
Online
108758
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-21-2007 11:18 PM
тАО10-21-2007 11:18 PM
Calling Function in another Script
Hi,
I have a script file with me called "first.sh" and contains one function called "ValidateDOB" in it. I want to call this function from another script file "second.sh".
Can you pleaase help me to call this ..
I have a script file with me called "first.sh" and contains one function called "ValidateDOB" in it. I want to call this function from another script file "second.sh".
Can you pleaase help me to call this ..
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-21-2007 11:38 PM
тАО10-21-2007 11:38 PM
Re: Calling Function in another Script
Hi Joseni,
to do this you want to "source" first.sh from second.sh this is done using a period "."
Eg
#!/bin/sh
# this is second.sh
# Source first.sh
. /path/to/first.sh
# do stuff here
ValidateDOB
Cheers,
Philip.
to do this you want to "source" first.sh from second.sh this is done using a period "."
Eg
#!/bin/sh
# this is second.sh
# Source first.sh
. /path/to/first.sh
# do stuff here
ValidateDOB
Cheers,
Philip.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-22-2007 06:01 PM
тАО10-22-2007 06:01 PM
Re: Calling Function in another Script
Beside sourcing the file, you can also set FPATH to the directory where each function is in a file with the same name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-22-2007 08:13 PM
тАО10-22-2007 08:13 PM
Re: Calling Function in another Script
Hi,
bext solutin is to isolate teh function into a file and recall it by two script.
i.e.:
script1
....
. ValidateDOB.ksh
ValidateDOB
...
...
script2
....
. ValidateDOB.ksh
ValidateDOB
...
in alternative you can use the FPATCH variable.
HTH,
Art
bext solutin is to isolate teh function into a file and recall it by two script.
i.e.:
script1
....
. ValidateDOB.ksh
ValidateDOB
...
...
script2
....
. ValidateDOB.ksh
ValidateDOB
...
in alternative you can use the FPATCH variable.
HTH,
Art
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP