LinuxQuestions.org
Visit Jeremy's Blog.
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 01-10-2010, 04:08 PM   #1
action_owl
Member
 
Registered: Jan 2009
Location: 127.0.0.1
Distribution: Fedora, CentOS, NetBSD
Posts: 115

Rep: Reputation: 17
#!/bin/"insert scripting language here"


How does one go about allowing Bash to interpret other scripting languages such as:

Code:
#!/bin/php

...script...
or even:

Code:
#!/bin/javascript

...script...
 
Old 01-10-2010, 04:19 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
You can use (examples):

Code:
#!/usr/bin/env java

#!/usr/bin/env php
I'm not sure about javascript; this functionality depends on what executables are avail to the `env` binary.

I came across a few other examples of this the other day via google, but cann't recall what exactly I was searching for when I encountered them.. You should be able to find other examples though.

Plus, I don't know that this literally "makes bash use the other interpreter itself", but rather, it transfers execution to the indicated interpreter (which I think is what you want, no?).

Sasha

Last edited by GrapefruiTgirl; 01-10-2010 at 04:20 PM.
 
  


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
script using "/usr/bin/cat error" produces "cannot open" in cron Dcrusoe Programming 6 07-22-2009 03:30 PM
How to get the "data type" of an "unknown variable" in "C Language" ? Affair Programming 8 06-20-2009 12:30 PM
LFS6.3 - Ch5.4.1 "/bin/sh sort not found" error at "make bootstrap" ubyt3m3 Linux From Scratch 2 06-23-2008 12:09 AM
problem "make"ing gtk+ "/usr/bin/env: perl -w" caid Linux - Newbie 8 07-29-2005 04:51 AM
what is "S" instead of "X" in the file permission when i look at /usr/bin/chsh? Linux_interest Linux - Newbie 4 08-28-2004 09:22 AM

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

All times are GMT -5. The time now is 10:21 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
Open Source Consulting | Domain Registration