⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 portabilityissues.html

📁 Shall高级编程
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><HTML><HEAD><TITLE>Portability Issues</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="Advanced Bash-Scripting Guide"HREF="index.html"><LINKREL="UP"TITLE="Miscellany"HREF="miscellany.html"><LINKREL="PREVIOUS"TITLE="Security Issues"HREF="securityissues.html"><LINKREL="NEXT"TITLE="Shell Scripting Under Windows"HREF="winscript.html"><METAHTTP-EQUIV="Content-Style-Type"CONTENT="text/css"><LINKREL="stylesheet"HREF="common/kde-common.css"TYPE="text/css"><METAHTTP-EQUIV="Content-Type"CONTENT="text/html; charset=iso-8859-1"><METAHTTP-EQUIV="Content-Language"CONTENT="en"><LINKREL="stylesheet"HREF="common/kde-localised.css"TYPE="text/css"TITLE="KDE-English"><LINKREL="stylesheet"HREF="common/kde-default.css"TYPE="text/css"TITLE="KDE-Default"></HEAD><BODYCLASS="SECT1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#AA0000"VLINK="#AA0055"ALINK="#AA0000"STYLE="font-family: sans-serif;"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">Advanced Bash-Scripting Guide: An in-depth exploration of the art of shell scripting</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="securityissues.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 33. Miscellany</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="winscript.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="PORTABILITYISSUES"></A>33.10. Portability Issues</H1><P>This book deals specifically with Bash scripting on	  a GNU/Linux system. All the same, users of <BCLASS="COMMAND">sh</B>	  and <BCLASS="COMMAND">ksh</B> will find much of value here.</P><P>As it happens, many of the various shells and scripting	  languages seem to be converging toward the POSIX 1003.2	  standard. Invoking Bash with the <TTCLASS="OPTION">--posix</TT>	  option or inserting a <BCLASS="COMMAND">set -o posix</B> at the	  head of a script causes Bash to conform very closely to this	  standard. Another alternative is to use a	  <ICLASS="FIRSTTERM">#!/bin/sh</I>	  <AHREF="sha-bang.html#SHABANGREF">sha-bang header</A> in the script,	  rather than	  <ICLASS="FIRSTTERM">#!/bin/bash</I>.	    <ANAME="AEN19186"HREF="#FTN.AEN19186">[1]</A>	  Note that <TTCLASS="FILENAME">/bin/sh</TT> is a <AHREF="external.html#LINKREF">link</A> to <TTCLASS="FILENAME">/bin/bash</TT>	  in Linux and certain other flavors of UNIX, and a script invoked	  this way disables extended Bash functionality.</P><P>Most Bash scripts will run as-is under	  <BCLASS="COMMAND">ksh</B>, and vice-versa, since Chet Ramey has	  been busily porting <BCLASS="COMMAND">ksh</B> features to the	  latest versions of Bash.</P><P>On a commercial UNIX machine, scripts using GNU-specific	  features of standard commands may not work. This has become less	  of a problem in the last few years, as the GNU utilities have	  pretty much displaced their proprietary	  counterparts even on <SPANCLASS="QUOTE">"big-iron"</SPAN> UNIX.	  <AHREF="http://linux.oreillynet.com/pub/a/linux/2002/02/28/caldera.html"TARGET="_top">Caldera's	  release of the source</A> to many of the original UNIX	  utilities has accelerated the trend.</P><P><ANAME="BASHCOMPAT"></A></P><P>Bash has certain features that the traditional Bourne shell	  lacks. Among these are:	<UL><LI><P>Certain extended <AHREF="options.html#INVOCATIONOPTIONSREF">invocation options</A></P></LI><LI><P><AHREF="commandsub.html#COMMANDSUBREF">Command substitution</A> using	  <BCLASS="COMMAND">$(    )</B> notation</P></LI><LI><P>Certain <AHREF="string-manipulation.html#STRINGMANIP">string manipulation</A>	  operations</P></LI><LI><P><AHREF="process-sub.html#PROCESSSUBREF">Process substitution</A></P></LI><LI><P>Bash-specific <AHREF="internal.html#BUILTINREF">builtins</A></P></LI></UL>	</P><P>See the <AHREF="ftp://ftp.cwru.edu/pub/bash/FAQ"TARGET="_top">Bash	   F.A.Q.</A> for a complete listing.</P></DIV><H3CLASS="FOOTNOTES">Notes</H3><TABLEBORDER="0"CLASS="FOOTNOTES"WIDTH="100%"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="5%"><ANAME="FTN.AEN19186"HREF="portabilityissues.html#AEN19186">[1]</A></TD><TDALIGN="LEFT"VALIGN="TOP"WIDTH="95%"><P>Or, better yet, <AHREF="system.html#ENVV2REF">#!/bin/env sh</A>.</P></TD></TR></TABLE><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="securityissues.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="index.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="winscript.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Security Issues</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="miscellany.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Shell Scripting Under Windows</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -