• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how can i call a shell script method in other program

 
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

or shorter
 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
reply
    Bookmark Topic Watch Topic
  • New Topic