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
command << EOF(dont want to call other script) user_prady Shell Programming and Scripting 4 11-15-2007 04:19 AM
here document to automate perl script that call script hogger84 Shell Programming and Scripting 3 10-22-2007 10:15 AM
How to call a perl script from a shell script anumkoshy Shell Programming and Scripting 2 08-30-2007 04:23 AM
Wget call in a Perl script rahulrathod UNIX for Advanced & Expert Users 1 12-28-2005 06:45 AM
how to call a perl script from tcsh? megastar Shell Programming and Scripting 1 10-22-2005 05:48 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-14-2005
umen umen is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 239
how can call perl script as command?

Hello
say i have written some perl scripts , now i like to call them in my unix shell
as unix command like "more" , "ls" , "grep" so that my say perl script called "foo.pl"
will be called from every where as "foo" or "foo arg1 arg2"?

Thanks
  #2 (permalink)  
Old 10-14-2005
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
$ mv foo.pl /usr/local/bin/foo
$ export PATH=$PATH:/usr/local/bin
$ chmod +x /usr/local/bin/foo
$ foo

i.e. - move the perl script to a suitable location. if it's for your own use, leave it in $HOME/bin - notice we drop the .pl extension - your shebang line will tell the shell which interpreter to use...

Add the directory where the script now resides to the PATH variable if it doesn't already exist - add this to your shells initialisation files to make it persistent.

Make the script executable.

Run it.

Cheers
ZB
Closed Thread

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 03:54 PM.


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