Debian Codegraph @

ex52.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # Uudecodes all uuencoded files in current working directory.
3
4 lines=35 # Allow 35 lines for the header (very generous).
5
6 for File in * # Test all the files in $PWD.
7 do
8 search1=`headscip-shell system . . head. -n $lines $File | grepscip-shell system . . grep. begin | wcscip-shell system . . wc. -w`
9 search2=`tailscip-shell system . . tail. -n $lines $File | grepscip-shell system . . grep. end | wcscip-shell system . . wc. -w`
10 # Uuencoded files have a "begin" near the beginning,
11 #+ and an "end" near the end.
12 if [scip-shell system . . `[`. "$search1" -gt 0 ]
13 then
14 if [scip-shell system . . `[`. "$search2" -gt 0 ]
15 then
16 echoscip-shell system . . echo. "uudecoding - $File -"
17 uudecode $File
18 fi
19 fi
20 done
21
22 # Note that running this script upon itself fools it
23 #+ into thinking it is a uuencoded file,
24 #+ because it contains both "begin" and "end".
25
26 # Exercise:
27 # --------
28 # Modify this script to check each file for a newsgroup header,
29 #+ and skip to next if not found.
30
31 exit 0