The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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
Passing more than one argument in a function jisha Shell Programming and Scripting 1 04-23-2008 07:05 AM
How to pass variables to FUNCTION ? bh_hensem Shell Programming and Scripting 5 05-31-2007 03:54 AM
How do I pass a wild card as an argument eja UNIX for Dummies Questions & Answers 2 03-28-2007 03:03 PM
Passing Argument to Function AkumaTay UNIX for Dummies Questions & Answers 2 10-18-2001 07:24 PM
pass argument to a filename jpprial UNIX for Dummies Questions & Answers 1 09-03-2001 04:12 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 04-08-2007
Knotty Knotty is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 11
Pass argument to function

Hi,
Can someone please explain to me how I can get a function to recognize a file given as an argument to a script.

Suppose the script has the argument as follows:

sh script file

and the function is as follows:
function display_file () {
cat $1
}

and it s then called
#main program
display_file

I find that the only way that I can get the file into the function is to make a copy in the main program like so:
cp $1 temp

I have read some lit on functions but haven't come accross this type of problem as far.

Thanks in advance,
Knotty.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:51 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0