Solved

bash and sh-compatibility

Posted on 2002-05-15
3
1,072 Views
Last Modified: 2008-01-16
bash claims to be sh-compatible in it's man-page. This seems to be wrong:

     echo 1>file
and
     echo 0>file
and
     # as many other examples as you like ..

is valid sh syntax.

Does somebody know how to tell bash to be sh-compatible?
Or is there a free (GPL or whatever) sh for Linux?
0
Comment
Question by:ahoffmann
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 100 total points
ID: 7012396
If you are talking about the differences with using echo under sh vs echo under bash then you aren't actually talking about shell incompatiblity. In some implementations of sh echo is a built in and in other's it isn't. Furthermore, each system seems to have a different idea of exactly what echo does and how it behaves. If you examine very many spohisticated multi-platform scripts (or try to write same) you'll find that they frequently go to a lot of trouble to figure out what flavor of echo is available.

I'd be interested in places that you see incompatibility that  only involve the standard Bourne shell commands.
0
 
LVL 51

Author Comment

by:ahoffmann
ID: 7012505
damn, should have thought about built in echo, 'cause I'm used to some other dragons with it too ;-)

Anyway it behaves equal in both: bash and sh (Solaris, didn't check carefully)

> I'd be interested in places that you see incompatibility that  only involve the standard Bourne shell commands
see : command
0
 
LVL 40

Expert Comment

by:jlevie
ID: 7012828
Personally I've never found any cases of valid Bourne shell syntax that Bash wouldn't execute, assuming that builtin vs not-builtin aren't an issue. The reverse is not true. Bash has some features (e.g., export, etc) that Bourne shell doesn't.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now