How to define a bash function for use in any script?
2014-06-12 13:56
423 查看
0down vote | Place your "common" function in a separate script (let's call it "a"):#!/bin/bash test_fun () { echo "hi" } Next, "import" it into another script (say, "b"): #!/bin/bash . ./a test_fun Running bash bwill output "hi" |
0down vote | Place your "common" function in a separate script (let's call it "a"):#!/bin/bash test_fun () { echo "hi" } Next, "import" it into another script (say, "b"): #!/bin/bash . ./a test_fun Running bash bwill output "hi" |
相关文章推荐
- JS:Trim() in javascript, how to define a function of checkinput for a WebControl(ascx)
- How to Use the BASH "for" Loop in Shell Scripts
- How to format date for display or to use in a shell script
- [quote]HowTo Format Date For Display or Use In a Shell Script
- How to create aligned partitions in Linux for use with NetApp LUNs, VMDKs, VHDs and other virtual di
- How to separate the implementation and definition for template function in c++
- How To Use WordBasic Functions in an MFC Automation Client for Word 97, Word 2000, Word 2002, or Word 2003
- How to use Wise SetupCapture in the Wise Packager for Deployment Server to create an MSI
- How to create custom methods for use in spring security expression language annotations
- How to use ActiveRecord in a ruby script outside Rails?
- (转)How to use udev for Oracle ASM in Oracle Linux 6
- How to save data in ASCII format in ADS for use in MATLAB
- How to define multiple controllers for one view in angularJS?
- How to use an ActiveX script task to create a loop in DTS
- How to Collect Errorstacks for use in Diagnosing Performance Issues. (文档 ID 1364257.1)
- [原] XAF How to use Signle() function in PersistentAlias with Many-To-Many scenario
- Bash tip: How to stop many processes in with a small script
- How to use "for/" batch command in Dos extention
- How to use Regular Expression in LotusScript
- How to use the same thread function for multiple threads (safely)