~ubuntu-branches/ubuntu/trusty/abs-guide/trusty-proposed

« back to all changes in this revision

Viewing changes to ex52.sh

  • Committer: Package Import Robot
  • Author(s): Sandro Tosi
  • Date: 2012-06-03 10:57:27 UTC
  • mfrom: (1.2.6)
  • Revision ID: package-import@ubuntu.com-20120603105727-rm7frl4feikr2swm
Tags: 6.5-1
* New upstream release
* debian/watch
  - updated
* debian/abs-guide.lintian-overrides
  - updated for new upstream code
* debian/control
  - bump Standards-Version to 3.9.3 (no changes needed)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/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=`head -n $lines $File | grep begin | wc -w`
 
9
  search2=`tail -n $lines $File | grep end | wc -w`
 
10
  #  Uuencoded files have a "begin" near the beginning,
 
11
  #+ and an "end" near the end.
 
12
  if [ "$search1" -gt 0 ]
 
13
  then
 
14
    if [ "$search2" -gt 0 ]
 
15
    then
 
16
      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