![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| calling function inside awk | jisha | Shell Programming and Scripting | 2 | 04-14-2008 07:44 AM |
| Calling a function | ashika | UNIX for Dummies Questions & Answers | 5 | 09-12-2006 07:58 PM |
| Calling other file function | maldini | Shell Programming and Scripting | 3 | 08-19-2005 02:23 AM |
| calling c++ function from script | Lebamb | High Level Programming | 3 | 06-24-2003 09:53 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Calling on function from file??
This may sounds dumb, but can I call on a function from a file? For example, I have a function file full of functions like below (no shell designation):
Code:
func { echo "blah blah blah 1" }
func2 { echo "blah blah blah 2" }
func3 { echo "blah blah blah 3" }
![]() |
|
||||
|
(Talking about bash)
Yes, you can use those functions from another file if they have the correct syntax which is not the case. For bash functions you could have a file say file_number_one.sh: Code:
function func { echo "bla bla bla1"; }
Code:
. ./file_number_one.sh func |
|
||||
|
As an aside, function is a Bashism. The POSIX way to declare a function is
Code:
func () { body of function; }
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|