?
Solved

bash and sh-compatibility

Posted on 2002-05-15
3
Medium Priority
?
1,090 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 400 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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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é.
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month13 days, 21 hours left to enroll

801 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