home *** CD-ROM | disk | FTP | other *** search
- # Second-pass expression fixups:
-
- # Optimize expressions (for performance, not functionality) by
- # removing superfluous quoting and curly braces:
-
- # 1. Inside ( ... ) expressions:
-
- # "${foo}" --> foo
- # "$foo" --> foo
- # "123" --> 123
-
- # 2. In @ (assignment statements):
-
- # ${foo} --> foo
- # $foo --> foo
-
- # 3. Fixup earlier fixups that were looking for the end of a wordlist:
-
- # A[0] != "" --> A != ""
-
- # 4. Fixup any assignments not already rewritten:
-
- # foo=... --> set foo=...
-
- /^[^#]* (.*)/{
- s/"\${\([^}]*\)}"/\1/g
- s/"\$\([^"]*\)"/\1/g
- s/"\([1-9][0-9]*\)"/\1/g
- s/"0"/0/g
- }
-
- /^[^#]*@ /{
- s/\${\([^}]*\)}/\1/g
- s/\$\([a-zA-Z0-9_]*\)/\1/g
- }
-
- s/\[0\] != ""/ != ""/
-
- /^[ ]*[a-zA-Z][a-zA-Z0-9_]*[ ]*=/s/[a-zA-Z]/set &/
-