LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-05-2008, 02:09 PM   #1
baidym
LQ Newbie
 
Registered: Oct 2007
Posts: 16

Rep: Reputation: 0
perl inside a shell script


Hi guys,

I know..., the first thing you're going to say "why?, just use perl for gods sake!!". Well... just because ok

I've been writing lots of scripts that call on other scripts and it's just getting messy. I'd like to write a shell that calls on perl (without writing "perl" at the start of each command) and then goes back to shell without any fuss. I assume it'll be some kind of while statement but I'm not exactly sure.

thankx

M.
 
Old 05-05-2008, 03:29 PM   #2
beadyallen
Member
 
Registered: Mar 2008
Location: UK
Distribution: Fedora, Gentoo
Posts: 209

Rep: Reputation: 36
You could try using a here construct like:
Code:
perl <<'EOF'
put
your
perl 
lines
here

EOF
It's nicer to have perl scripts as separate executables though. Embedding them will likely cause problems with variable expansion and the like.
 
Old 05-05-2008, 06:42 PM   #3
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,280

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Well,depending exactly how you use Perl, if you put
#!/usr/bin/perl -w
at the top of each perl script and make it executable, then you can call it without mentioning Perl eg

./myperlscript1.pl
 
  


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
arithmethic function inside shell script mystical dervish Linux - Newbie 3 08-21-2007 04:57 AM
Can I execute a shell script from inside a php one. prabhatsoni Linux - Software 2 05-24-2006 05:40 AM
embedded shell script from inside fortran TheBrick Programming 2 05-22-2006 08:23 AM
calling a c++ binary inside a perl script Blue_muppet Programming 3 08-28-2004 11:31 PM
changing the user inside a shell script sanjith11 Programming 2 04-22-2004 07:44 AM


All times are GMT -5. The time now is 05:10 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