|
Revision 1748, 1.0 kB
(checked in by anarcat, 2 years ago)
|
faire que wc marche aussi avec le chemin absolu
|
- Property svn:executable set to
*
|
| Line | |
|---|
| 1 |
#!/bin/sh |
|---|
| 2 |
. /etc/alternc/local.sh |
|---|
| 3 |
|
|---|
| 4 |
AWK=/usr/bin/awk |
|---|
| 5 |
DF=/bin/df |
|---|
| 6 |
SED=/bin/sed |
|---|
| 7 |
MOUNT=/bin/mount |
|---|
| 8 |
QUOTA=/usr/bin/quota |
|---|
| 9 |
GREP=/bin/grep |
|---|
| 10 |
WC=/usr/bin/wc |
|---|
| 11 |
|
|---|
| 12 |
DATA_PART=`$DF ${ALTERNC_LOC} 2>/dev/null | $AWK '/^\// { print $1 }'` |
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
QUOTA_PART=`$MOUNT | $SED -n -e "s,\([^ ]*\) on ${DATA_PART} type nfs.*,\1,p"` |
|---|
| 18 |
if [ -z "$QUOTA_PART" ]; then |
|---|
| 19 |
QUOTA_PART="$DATA_PART" |
|---|
| 20 |
fi |
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
PART_LEN=`echo -n "$QUOTA_PART" | $WC -c` |
|---|
| 25 |
if [ "$PART_LEN" -gt 15 ]; then |
|---|
| 26 |
$QUOTA -g "$1" | |
|---|
| 27 |
$SED -n -e "\\;${QUOTA_PART};,+1s/ *\([0-9]*\) .*/\1/p" | |
|---|
| 28 |
$GREP -v '^$' |
|---|
| 29 |
$QUOTA -g "$1" | |
|---|
| 30 |
$SED -n -e "\\;${QUOTA_PART};,+1s/ *[0-9]* *\([0-9]*\) .*/\1/p" | |
|---|
| 31 |
$GREP -v '^$' |
|---|
| 32 |
else |
|---|
| 33 |
$QUOTA -g "$1" | $AWK /${QUOTA_PART//\//\\\/}/\ {print\ '$2'} |
|---|
| 34 |
$QUOTA -g "$1" | $AWK /${QUOTA_PART//\//\\\/}/\ {print\ '$3'} |
|---|
| 35 |
fi |
|---|
| 36 |
|
|---|