• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how can i call a shell script method in other program

 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a problem in calling the methods being inside in another shell script program

can any one please tell me how to call a method which is there in another shell script is there any command to import that shell script file in my current program?

The reason why i am doing this thing is i am writing more frequenty used methods in one palce (utility.sh) file

so here i want to call the methods when ever i require to use it in other program
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

or shorter
 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Stefan Wagner:

or shorter


No Mr Stefan..
I have not intended to callt the script file instead my question was like this
There is utility file in which there are multiple methods which take parameters when passed

so now in my program i want to call one particular method in utility script file by passing some parameters

So how cna i call a particular methods of other scipt file ?
any command ?

thanks for helping me
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by saikrishna cinux:


No Mr Stefan..
I have not intended to callt the script file instead my question was like this
There is utility file in which there are multiple methods which take parameters when passed

so now in my program i want to call one particular method in utility script file by passing some parameters

So how cna i call a particular methods of other scipt file ?
any command ?

thanks for helping me

Stefan is my first name, just call me Stefan.

When you source a file which contains just functions, not code calling these functions, they are available for execution by your script.

utils.sh:

useutils.sh sources utils.sh and calls the functions:

output:
2008-14-01/23/08
3 2 1
2008-14-01/23/08
1 2 3
2008-14-01/23/08
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic