How to call a function with parameter in a bash script?

Let’s learn how to call a function with parameter in a bash script. The most accurate or helpful solution is served by tldp.org.

There are ten answers to this question.

Best solution

BASH Programming - Introduction HOW-TO: Functions

Calling a function is just like ... you are not absolutely sure about what this script ... 8.2 Functions with parameters sample #!/bin/bash ...

tldp.org

Other solutions

Beginner Bash scripting question? FASTEST CORRECT ANSWER GETS BEST ANSWER ***?

This is my script, I am trying to write a script to take a PID as a parameter, and display the parent PID of it, and the parent PID of its parent PID, all the way until I get back to process 1. Basically, showing the lineage of any PID back to process...

Answer:

#!/bin/bash if [ ! -d /proc/$1/ ]; then echo "That is not a valid PID" exit fi if [ ! $# ...

Read more

coffeeho... at Yahoo! Answers Mark as irrelevant Undo

Does jQuery's $.ajax call support only transfer of json or script data types, when request is cross-domain?

I can see the data downloaded in my chrome console if the url is not json such as home page of Hacker News.But it's not accessible in the success function.But if the url parameter is something that has json data as it's body, it is accessible through...

Answer:

By default, $.ajax can only use script or JSON dataTypes for cross-origin resources. The origin domain...

Read more

Rick Waldron at Quora Mark as irrelevant Undo

Help with HTML Code...?

I have been looking for a HTML code that has a menu on the left and a paragraph on the right where it's expands and collapses. I found this code, it is as close to what I want but the paragraphs' that expand and collase are next to the title. I would...

Answer:

That's too much code and information, I would like to help but you need to focus on smaller sections...

Read more

Foolish Soul at Yahoo! Answers Mark as irrelevant Undo

Images doesnt appear when view in browser?

Everything was there include the words of the images folder.. But the images doesnt appear. It give me a cross icon instead. Why is it so? i figure for quite sometimes and still cant get it.. Protected Sub Page_Load(ByVal sender As Object, ByVal e As...

Answer:

Is it suppose too? I didn't think images showed, kinda like editing a blog post, you get the X. As long...

Read more

Kelly at Yahoo! Answers Mark as irrelevant Undo

An odesk contractor appears to have added a script to my site.  I want to be fair, is there any way this is a mistake?

He was modifying an existing site.  The site he created caused several words on my page to appear hyperlinked and when you moused over a little advertising window appeared.  My site did NOT do this before.  I commented out a script that was not on the...

Answer:

data.htm is an entry point and run.js contains the actual code to add underlined ads as well as what...

Read more

Deep Joy Majumdar at Quora Mark as irrelevant Undo

Python: What's the best way to get the script to call a function from user input?

I have a script with many function each called problemx() where x is a number from 1 upwards i.e problem1(), problem2(), etc. It's difficult to explain the question but let me just show you. while True: ....user = raw_input('problem(blank to exit): ...

Answer:

For python 2.7: while True: user = raw_input('Problem no. (break to quit) -> ') if user == '': break...

Read more

Russel at Yahoo! Answers Mark as irrelevant Undo

I am trying to call another bash script from the current one help me?

my code is below I have written two scripts one to add user and another one to delete user I want to each one of that script using users input #!/bin/bash # # while : do clear echo ...show more

Answer:

new.sc del.sc need to be in the path and chmod 755 , to make executable. you should not need the "...

Read more

44PFXXOSUDOEPEXI5PBDSKWY7Q at Yahoo! Answers Mark as irrelevant Undo

Write the definition of a function signOf , which receives an integer parameter and returns a -1 if the param?

Write the definition of a function signOf , which receives an integer parameter and returns a -1 if the parameter is negative, returns 0 if the parameter is 0 and returns 1 if the parameter is positive. So if the parameter's value is 7 or 803 or 141...

Answer:

This is for python: def signOf (in_value): ....retval = 1 ....if in_value < 0: ........retval = ...

Read more

Winona R at Yahoo! Answers Mark as irrelevant Undo

What is the easiest way to create a GUI for a bash script that takes multiple text inputs at the same time?

I have some bash script to create a simple verification test-bench which takes some argument like agent name, driver name, sequencer name etc. Now I want to create a gui for this bash script in which there will be some button like create or add, some...

Answer:

In addition to python with wxpython there is also Python/Tk and Tcl/Tk. Tcl/Tk is arguably much more...

Read more

Doug Hughes at Quora Mark as irrelevant Undo

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.