Article View: comp.std.unix
Article #178Control characters in the shell
From: Karl Heuer
Date: Wed, 21 Mar 1990 20:51
Date: Wed, 21 Mar 1990 20:51
29 lines
2079 bytes
2079 bytes
From: karl@IMA.IMA.ISC.COM (Karl Heuer) This came up in comp.org.usrgroup, but I think this is a better place. Observation: The shell, considered as a programming language, has a string datatype but does not have adequate facilities for embedding nonprinting characters in a string constant. As a result, several commands (date, echo, paste, prs, stty, tr) have evolved (largely incompatible) notations for translating escape sequences into such nonprinting characters. Opinion: A much cleaner solution would be to have a simple shell syntax which causes the nonprinting characters to be embedded into the argument string, so that it would be transparent to the program. Proposal: Reserve $\ (dollar-backslash) as a new entity that begins a C-like escape, so we would have $\a $\b $\t $\n $\v $\f $\r, octal escapes like $\177, and hex escapes like $\x7F. Alternative proposal (from a suggestion by Eric Gisin, eric@mks.com): make a new string quoting mechanism, $"...", which is just like "..." except that, in addition to the four current backslash escapes \$ \` \" \\ that are permitted inside double quotes, all the C-like escapes \a etc. would be recognized. I'm told that the POSIX shell does not address this perceived deficiency. I hope it's not too late for this to be corrected. Karl W. Z. Heuer (karl@ima.ima.isc.com or harvard!ima!karl), The Walking Lint Volume-Number: Volume 19, Number 20
Technical Details
Message-ID:
<589@longway.TIC.COM>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!longway!std-unixReferences:
<2567@mbf.UUCP> <EQ.1811xds13@ficc.uu.net> <16108@haddock.ima.isc.com> <1990Mar8.171918.16011@mks.com> <16184@haddock.ima.isc.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!longway!std-unix From: karl@IMA.IMA.ISC.COM (Karl Heuer) Newsgroups: comp.std.unix Subject: Control characters in the shell Keywords: Draft 9 shell meta standard shell Message-ID: <589@longway.TIC.COM> Date: 21 Mar 90 20:51:46 GMT References: <2567@mbf.UUCP> <EQ.1811xds13@ficc.uu.net> <16108@haddock.ima.isc.com> <1990Mar8.171918.16011@mks.com> <16184@haddock.ima.isc.com> Sender: std-unix@longway.TIC.COM Reply-To: karl@IMA.IMA.ISC.COM (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 29 Approved: jsq@longway.tic.com (Moderator, John S. Quarterman)