LinuxQuestions.org
Visit Jeremy's Blog.
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 11-13-2013, 12:00 AM   #1
rohit.dhaval1
Member
 
Registered: Jul 2009
Posts: 39
Blog Entries: 2

Rep: Reputation: 0
Unable to create a function in BASH


I want to create a function in .bashrc to ease checking version of perl module. Can someone help me create one

The command to be put in .bashrc is

perl -MXML::LibXML -e 'print "$XML::LibXML::VERSION\n"'

I want to be able to run above as


p XML::LibXML
 
Old 11-13-2013, 01:30 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,492

Rep: Reputation: 2429Reputation: 2429Reputation: 2429Reputation: 2429Reputation: 2429Reputation: 2429Reputation: 2429Reputation: 2429Reputation: 2429Reputation: 2429Reputation: 2429
what have you done so far?
 
Old 11-26-2013, 08:14 AM   #3
rohit.dhaval1
Member
 
Registered: Jul 2009
Posts: 39
Blog Entries: 2

Original Poster
Rep: Reputation: 0
Sorry, didn't reply on time.. I figured out a way myself

>>>>> Lines from .bashrc

p () {
/usr/bin/perl -M"$@" -e 'print "$'"$@"'::VERSION\n"'
}
 
  


Reply

Tags
bash, function


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
[SOLVED] Is it possible to create a bash script to create multiple new bash scripts Batistuta_g_2000 Linux - Newbie 6 02-19-2013 12:42 PM
[SOLVED] Setting function default in a bash script - Bash sixtensixone Linux - General 13 01-08-2011 02:44 PM
Bash array Add function example using indirect array reference as function argument bobywelsh Programming 10 07-05-2010 05:44 AM
create a global associative array variable inside a function of a bash script konsolebox Programming 3 07-14-2009 07:08 AM
Bash looping or function within a function FirmbIT Programming 2 04-24-2006 02:06 PM


All times are GMT -5. The time now is 01:50 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration