create a new script, automatically populating the shebang line, editing the script, and making it executable.

shebang() { if i=$(which $1); then printf '#!%s\n\n' $i > $2 && vim + $2 && chmod 755 $2; else echo "'which' could not find $1, is it in your \$PATH?"; fi; }
The first argument is the interpreter for your script, the second argument is the name of the script to create.
Sample Output
$ shebang perl



By: bartonski
2011-03-09 14:47:32

What Others Think

What about #!/usr/bin/env python? For us Pythoneers.
kaedenn · 596 weeks and 6 days ago
Hmm. Good question. I think that I would try to figure out if the interpreter will run inside /usr/bin/env, then fall back to $(which $1) if that didn't work. /usr/bin/env $1 --version Should return true for perl, python, ruby, bash...
bartonski · 596 weeks and 6 days ago
maybe something like this... ENV=/usr/bin/env; if i=$($ENV $1 --version && echo "$ENV $1" || which $1) ...
bartonski · 596 weeks and 6 days ago
spam blockers are always necessary because there are so many spam these days,. ?????? ??????? ?????????
nakav51247 · 29 weeks and 1 day ago
This site is actually amazing. We constantly run into something new & diverse correct right here. Appreciate which data. ??????
nakav51247 · 29 weeks and 1 day ago ??? ? ????? ????
seofox · 27 weeks and 6 days ago
One of the most lucrative fields that you can get into as a salesperson is selling to other businesses and especially selling merchant accounts. how to start a credit card processing business
nakav51247 · 27 weeks and 5 days ago
seofox · 27 weeks ago
Optimal humanity messages, because toasts. are hands down sent out certain times in the evening reception and therefore are supposed to end entertaining, amusing furthermore useful what’s more. best man speaches Visa ea Bahahlauli ba New Zealand
nakav51247 · 27 weeks ago
Explore Revexpo, A Indian review website, Their Article will help you to pick the right Best fogg scent in india along with a proper buying guide. Fogg comes in a wide and unique range of fragrances for both men and women. Fogg is quite a revolutionary product in the deodorant market as it is liquid-based in nature.
KayGasaway · 26 weeks and 5 days ago
Aw, this has been an extremely good post. In notion I have to set up writing in this way moreover – taking time and actual effort to make a top notch article… but exactly what can I say… I procrastinate alot and also by no indicates seem to go done. India turistické vízum
yarosel701 · 25 weeks and 6 days ago
vinyl fence installer We offer Commercial and Residential fence installations and repairs in Cape Coral, SW Florida. Gator Fence Corp is the best fence service company in SW Florida ...
goxah55535 · 24 weeks and 3 days ago
Tooth Gem Certification Body Lab Enhancements & Training Academy introduces advanced refresher body enhancement certification courses as well as all kinds of enhancement services.
yarosel701 · 24 weeks and 3 days ago
Axiom care – Genuine repairs with genuine parts. In the event of your Huawei phone breakdown, please visit our care center or book online for a pick up request. Authorized Huawei repairs at affordable price at Axiom care.">Axiom care
nakav51247 · 24 weeks and 3 days ago
Our free prescription discount card offers you the best drug prices available without having to clip coupons for specific drugs. Enjoy the convenience of our .. ??????
goxah55535 · 23 weeks and 2 days ago
Contact us The new camp is hot and interesting. Fachai365 new slot directly from the service provider not through a web agent New open slots, contact ...
yarosel701 · 21 weeks ago
Newsletter subscription. Sign up for updates to receive information about new arrivals, future events and specials. Main menu. neo blue jogger pants
gexeji53 · 21 weeks ago
Business Translation Services | Business Translations - Gotham Lab Increase your sales with our certified business translation services for your businesses. Different Business Documments Translations as Contract Translations, Financial Translations, Marketing Translations & Proposal Translations. Gotham Lab is a New York based industry leader localization and translation services company. translation services for businesses
gexeji53 · 20 weeks and 1 day ago
Our cute and aesthetic cow print phone case are the perfect everyday case for your iPhone. The case is tough and durable, It’s sure to protect your device against high-impact drops, scuffs, and scratches.
gexeji53 · 19 weeks and 6 days ago
Discover nokia mobile repair in UAE. Authorized Nokia Mobile Repair Center | 20+ Year of Trust Get the best Nokia mobile repair service in your doorstep or our axiom care Book your Nokia mobile repair now at affordable price at Axiom care.
gexeji53 · 19 weeks and 5 days ago
Founded in 2021 by YBE, our blog offers readers the best of interesting topics for your everyday beauty needs.">fall nail colors
nakav51247 · 19 weeks and 4 days ago
As the pneumonia epidemic continues, more and more people will have to order to eat, but many people are relatively new to ordering takeaways, and most people think that traditional takeaways are the first for many people to eat. Visit this website & get catering service ,The service that will be used is actually a lot of small gatherings , mini parties as small as two or three people will be called. Free shipping and free exchange and return polices as well as Free snacks at FPs Checkout. Don't miss this chance. Attendance Discount?Latest Books Promotion?Kama party food delivery Catering. party food delivery
goxah55535 · 18 weeks and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: