home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
hcshdemo.zip
/
csh-os2.zip
/
SAMPLES
/
SH_2_CSH
/
MISC.SED
< prev
next >
Wrap
Text File
|
1993-11-24
|
1KB
|
60 lines
# Miscellaneous fixups:
# 1. The # beginning a comment must be followed by white space.
# Special case #=== lines to delete one =.
# 2. /dev/null (Unix) --> nul (OS/2 or NT)
# 3. $? (sh status) --> $status (csh status)
# 4. $! (sh last child) --> $child (csh last child)
# 5. kill -9 pid --> kill ppid
# 6. read foo --> @ foo = getline
# 7. Escape any $'s standing alone.
# 8. Escape any :'s following a variable reference.
# 9. Fixup any : null statements as ; statements and any : statements
# as tests in a while.
# 10. Fixup any if's without then's and any fi's that might have
# sneaked thru during case fixups.
/#[^ ]/{
s/#=/#/
s/#/# /
}
/# $/s/ $//
s/\/dev\/null/nul/
/^[^#']*\$\?/s/\$\?/$status/
/^[^#']*\$\!/s/\$\!/$child/
/^[ ]*kill -9 \$/s/-9 /p/
/^[ ]*read /s/read[ ][ ]*\([^ ]*\)/@ \1 = getline/
s/^\([^#]*\)\([^\\$]\)\$$/\1\2\\$/
s/^\([^#]*\)\([^\\$]\)\$\([^$a-zA-Z0-9{]\)/\1\2\\$\3/
/^[^#']*\${[^}]*}:/s/\(\${[^}]*}\):/\1\\:/
/^[^#']*\$[a-zA-Z][a-zA-Z0-9_]*:/s/\(\$[a-zA-Z][a-zA-Z0-9_]*\):/\1\\:/
/^[ ]*while[ ]*:$/s/:/( 1 )/
/^[^#"']*:/{
/case/ ! {
/default/ ! s/:/;/
}
}
/^[ ]*fi[ ]*$/s/fi/end/
/^[ ]*if/{
/then$/ ! s/$/ then/
}