LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 06-03-2004, 01:14 AM   #1
gSalsero
Member
 
Registered: Jan 2004
Location: Denver, CO USA
Distribution: Open Suse 10.0, Windows XP Home & Pro & Media Center, Mac OS X
Posts: 36

Rep: Reputation: 15
associate/register file extensions


I have searched in many places and I can't find an answer for this questions.

Is there a way to associate/register a file extension such as *.pl so that when I run a script called test.pl from the shell, I don't have to type "perl test.pl" just "test.pl".

Another question, windows has a PATHEXT environment variable is there something equivalent in Linux?

thanks for your help.
 
Old 06-03-2004, 09:07 AM   #2
Oliv'
Senior Member
 
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36
Hi,

you don't need such things... If your script is correct, I mean begin with:
Code:
#!/usr/bin/perl -w
and has executable rights, then just type ./my_script.pl and it runs

About your windows question, I can't answer you as I dunno what PATHEXT represents

Oliv'
 
Old 06-03-2004, 03:57 PM   #3
gSalsero
Member
 
Registered: Jan 2004
Location: Denver, CO USA
Distribution: Open Suse 10.0, Windows XP Home & Pro & Media Center, Mac OS X
Posts: 36

Original Poster
Rep: Reputation: 15
thanks, does that work with bash scripts as well
 
Old 06-04-2004, 03:29 AM   #4
Oliv'
Senior Member
 
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36
Of course, it works with Bash (#!/bin/bash)... and with a lot of other script languages like ruby...
about PATHEXT, I've done a quick search on it, and Linux doesn't provide such variable... But it would be easy to do it

Oliv'
 
  


Reply



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
cannot register an rpm file in mandriva theoldun Linux - Software 0 11-14-2005 02:25 AM
Need help with File Extensions Linux nooB 454 Linux - Newbie 3 04-10-2005 05:41 PM
How I can associate the right application back to a .desktop file? carbono Red Hat 0 08-07-2004 03:36 PM
how do i associate programs with file types? drrnsk8ter4 Linux - Software 2 04-25-2004 07:22 PM
how to register new file system ashishkumbhare General 1 03-21-2004 09:50 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:56 PM.

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
Open Source Consulting | Domain Registration