LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-02-2005, 04:49 AM   #1
nutthick
Member
 
Registered: Jun 2004
Distribution: Slack
Posts: 214

Rep: Reputation: 30
Bash Script Passing variable to Function


In Bash Script, what is the syntax for passing a variable to a function. I'm assuming it's something like.

function MyFunction(MyVariable)
{
}

and then to call it you do something like

MyFunction(10)

but I can't get it to work.

Thanks
 
Old 02-02-2005, 05:08 AM   #2
nixcraft
Member
 
Registered: Nov 2004
Location: BIOS
Distribution: RHEL3.0, FreeBSD 5.x, Debian 3.x, Soaris x86 v10
Posts: 379

Rep: Reputation: 30
see http://www.cyberciti.biz/nixcraft/li...t/scripts/pass
 
Old 02-02-2005, 05:15 AM   #3
nutthick
Member
 
Registered: Jun 2004
Distribution: Slack
Posts: 214

Original Poster
Rep: Reputation: 30
Thanks nixcraft worked a treat
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can a C function return value to Shell Script variable yarnar Programming 17 06-02-2010 05:54 PM
C++ / Passing a variable by reference to a class member function. sepulture Programming 12 11-15-2005 10:23 PM
Passing parameters to bash script Kamikazee Programming 4 10-01-2005 06:41 AM
passing passing variable in Java as reference djgerbavore Programming 3 11-10-2004 02:18 PM
Passing Parameters to Bash Script mooreted Linux - Software 3 04-05-2004 09:08 PM


All times are GMT -5. The time now is 01:41 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration