add directory Ref-docs
This commit is contained in:
28
Ref-docs/manual Bash/abs-guide/abs-guide/ex52.sh
Normal file
28
Ref-docs/manual Bash/abs-guide/abs-guide/ex52.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
lines=35 # Allow 35 lines for the header (very generous).
|
||||
|
||||
for File in * # Test all the files in the current working directory...
|
||||
do
|
||||
search1=`head -$lines $File | grep begin | wc -w`
|
||||
search2=`tail -$lines $File | grep end | wc -w`
|
||||
# Uuencoded files have a "begin" near the beginning,
|
||||
#+ and an "end" near the end.
|
||||
if [ "$search1" -gt 0 ]
|
||||
then
|
||||
if [ "$search2" -gt 0 ]
|
||||
then
|
||||
echo "uudecoding - $File -"
|
||||
uudecode $File
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Note that running this script upon itself fools it
|
||||
#+ into thinking it is a uuencoded file,
|
||||
#+ because it contains both "begin" and "end".
|
||||
|
||||
# Exercise:
|
||||
# Modify this script to check for a newsgroup header.
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user