Movatterモバイル変換


[0]ホーム

URL:


Jump to content
Rosetta Code
Search

Bourne Shell

From Rosetta Code
This page is a stub. It needs more information! You can help Rosetta Code by filling it in!
Bourne Shell is animplementation ofUNIX Shell.Other implementations of UNIX Shell.

TheBourne Shell is aUnix shell upon which many shells are based; notably theKorn shell andBourne Again SHell. (The other major tree of Unix shells descend fromcsh.)

Portable Shell Syntax is the scripting language syntax used by theSystem V Bourne shell. This syntax is compatible with the heirloom shell and is the syntax documented in most Unix books. Examples marked "Works with: Bourne Shell" should work in any of the Bourne-compatible shells.

A Bourne Shell script begins with ashebang (also known as ahashbang) like this, which tells the operating system to use the Bourne compatible shell interpreter:

#!/bin/sh

In 2009,Computerworld published an in-depth interview with Steve Bourne, "The A-Z of Programming Languages: Bourne shell, or sh", which details the Bourne shell origins and design decisions.

Bugs

Bourne Shell and Heirloom Shell have problems with here documents. Here is one such problem. A substitution, inside a here document, inside backquotes, inside double quotes, does insert too many backslashes.

f(){cat<<!here$1!}expr"`f string`"# Output from Bourne Shell:     here \s\t\r\i\n\g# Correct output:               here string

The workaround is to move the backquotes to an assignment.

f(){cat<<!here$1!}var=`fstring`expr"$var"# Output:     here string
Retrieved from "https://rosettacode.org/wiki/Bourne_Shell?oldid=345934"
Categories:
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

[8]ページ先頭

©2009-2026 Movatter.jp