Need help on Bash syntax

Chet Ramey chet at cwns1.CWRU.EDU
Fri Sep 7 02:19:56 AEST 1990


Brad Appleton asks:

>Im getting desperate for this info -- please give me as much info as you 
>can on bash arrays.

OK.  Bash does not have arrays.  Yet.  Maybe later.

>Also, in bash, what characters need to be escaped inside of double
>quotes (including "\", '$' and '`' etc ...) in order to interpreted
>literally by the shell (I need an exhaustive list).

Inside double quotes, all characters retain their literal meanings, with
the exception of $, `, and \.  $ and ` retain their special meaning.  The
backslash is special only when followed by one of the following characters:
$, `, ", \, or <newline>.

Here are some examples:

cwns1$ recho "\\"
argv[1] = "\"
cwns1$ recho "\b"
argv[1] = "\b"
cwns1$ recho "$PS1"
argv[1] = "cwns1$ "
cwns1$ recho "`echo hi`"
argv[1] = "hi"
cwns1$ recho "\$"
argv[1] = "$"
cwns1$ recho "\""
argv[1] = """
cwns1$ recho "\`"
argv[1] = "`"

I have fixed a lot of bugs in bash quoting and substitution, which should
all be in the next version.

>I have somewhat of a time limit and I cant wait long enough for the 
>documentation to arrive (and no one here has it).

FTP to cwns1.ins.cwru.edu (129.22.8.43) for my bash man page.  It's
in ~ftp/pub/bash.1.  The file ~ftp/pub/CWRU-differences lists the
items that differ between what is described in the manual (which is
for the version of bash in use at CWRU).  Most of that stuff should
make it into version 1.06.

Chet
-- 
Chet Ramey				``Levi Stubbs' tears run down
Network Services Group			  his face...''
Case Western Reserve University	
chet at ins.CWRU.Edu		



More information about the Comp.unix.shell mailing list