Shell Bashing

It was about three o'clock on a Thursday afternoon when Kevin called me. I remember the time because I had just been thinking about knocking off early. It had been a hard week, and the P&L was looking good, so I was ready for a break. Then my cell phone chimed, and when I pushed "Talk", Kevin's voice was in my ear.

Kevin doesn't call me all that often. We hardly ever see each other socially any more- he's in Seattle, I'm here on the East Coast. He's a Filepro and C kind of guy, neither of which I do much with any more. We keep in touch; Xmas cards and all that, but only chat now and then, and usually it's just that: chit chat.


Hate these ads?

But today Kevin had a problem. "I've got this script that keeps looping on itself and I can't figure out why".

Well, I knew better than to ask the obvious- Kevin is no fool: the script wouldn't be calling itself. But I also knew that Kevin was doing more and more Linux, so I asked "What OS?". The answer came across the country on fiber optic cables and was then broadcast for my cell phone to pick up: "Red Hat 6.1, patched to hell".

I thought for a second and said "Let's just try something- this isn't your answer, but just humor me. Put "#!/bin/sh" at the top of your script".

Kevin paused before he answered. He knows I'm not an idiot, but sometimes he wonders.. "Umm, sh is a link to bash on Linux", he said.

"I know", I explained, "but just do it anyway. Try it.". I heard keys clicking, and then his voice came back. "Son of a gun- it doesn't loop- I don't get it. What's going on?".

It was my turn to pause. "Well, I have another question, though it's really more of a statement: you have this script run when you log in, don't you?".






"Yes".

"That's the problem. You've done that wrong, and that's why it is looping".


Do you know what Kevin did wrong and why the "#!bin/sh" stopped the loop?

Answer

Publish your articles, comments, book reviews or opinions here!

© May 2001 A.P. Lawrence. All rights reserved




Comments /Detective/shbash.html


------------------------
Comments are closed for this page. You can comment at the "Answer" page.

ad

Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

Or use any RSS reader

Delivered by FeedBurner


Views for this page
Today This Week This Month This Year  Overall
912992,023 14,195

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

pavatar.jpg
More:
       - Detective
       - Shell




Related Posts

Using the shell in Mac OS X

iTerm is an alternative to Mac OS X Terminal.app

Bash history control

Clever Bash Tricks

MacOSX Skills Test

MacOSX Skills Test

Finding large files at the command line

Google Site search for "bashrc"

Numbering lines with bash

Death of the command line

Printing file listings

Why use the command line?


Unix/Linux Consultants

Your ad here - $24.00 yearly!

http://bcstechnology.net Full service Linux & UNIX systems integrator; Windows to UNIX/Linux Client-Server Specialist; Secure E-Mail & Website Hosting; Thoroughbred Software Developer; Custom Industrial Automation; Hardware & Electronics Experts; In Business Since 1985.


http://www.schewanick.com SCO Unix, Solaris, Linx (various), PHP, MySQL, Apache, uniBasic, dL4, Perl, System Administration and more....


http://www.cleverminds.net Need expert advice? Want a second opinion? CleverMinds is a one-stop-shop for a wide range of technology solutions. We support Unix, Linux, SCO as well as CMS, ecom, blogs, podcasts, search engines consulting and more. Contact us at web2.0@cleverminds.net 0r (617) 894-1282









Change Congress


Related Posts