home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume1
/
8712
/
12
< prev
next >
Wrap
Internet Message Format
|
1990-07-13
|
3KB
Path: uunet!husc6!rutgers!clyde!cbosgd!mandrill!hal!ncoast!allbery
From: davidsen@UUNET.UU.NET@steinmetz.UUCP
Newsgroups: comp.sources.misc
Subject: A shell script to create lost+found
Keywords: shell, lost+found
Message-ID: <6905@ncoast.UUCP>
Date: 26 Dec 87 02:48:23 GMT
Sender: allbery@ncoast.UUCP
Organization: GE Corp. R & D, Schenectady,NY
Lines: 77
Approved: allbery@ncoast.UUCP
X-Archive: comp.sources.misc/8712/12
[Some people seem to feel that rules are made to be broken: I had to create
the shar file for this, and since I've been working late recently it's about
two weeks late in posting. Moral: Follow the guidelines! ++bsa]
Some of the varieties of UNIX don't create a lost+found directory
in mkfs. Some don't even have a utility to make it for you. This script
was presented at the December meeting of *IX and seems generally useful.
It creates a lost+found on each mounted filesys which needs it, leaves
existing directories alone, and doesn't get upset if a volume is mounted
read only.
Please send any comments to the original author, his address is in the
comments of the script.
#--------------------------------CUT HERE-------------------------------------
#! /bin/sh
#
# This is a shell archive. Save this into a file, edit it
# and delete all lines above this comment. Then give this
# file to sh by executing the command "sh file". The files
# will be extracted into the current directory owned by
# you with default permissions.
#
# The files contained herein are:
#
# -rw-r--r-- 1 allbery System 744 Dec 25 21:44 mklost+found
#
echo 'x - mklost+found'
if test -f mklost+found; then echo 'shar: not overwriting mklost+found'; else
sed 's/^X//' << '________This_Is_The_END________' > mklost+found
X#!/bin/sh
X#
X# make lost+found
X# author: Brian Fitzgerald (uunet!steinmetz!sixhub!sixbdf!root)
X#
X# Creates a lost+found directory in any mounted partition in
X# which it does not exist.
X
Xfor partition in `mount | awk '{print $1}'`
Xdo
X cd $partition
X if [ -d lost+found ]
X then
X echo "$partition/lost+found already exists, nothing done to $partition"
X else
X echo "Making lost+found directory for $partition"
X mkdir "lost+found" ||
X { # This happens if mounted read only
X echo "Can't create dir in $partition"
X continue;
X }
X cd lost+found
X count=0
X echo "Creating dummy files"
X while [ $count != 128 ]
X do
X echo >file$count
X count=`expr $count + 1`
X done
X echo "Removing dummy files"
X rm *
X cd ..
X ls -ld lost+found
X fi
Xdone
________This_Is_The_END________
if test `wc -l < mklost+found` -ne 35; then
echo 'shar: mklost+found was damaged during transit (should have been 35 bytes)'
fi
fi ; : end of overwriting check
exit 0
--
bill davidsen (wedu@ge-crd.arpa)
{uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me