File: makeadir.sh

package info (click to toggle)
remstats 1.00a4-8woody1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 4,576 kB
  • ctags: 1,020
  • sloc: perl: 11,706; ansic: 2,776; makefile: 944; sh: 869
file content (32 lines) | stat: -rwxr-xr-x 626 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh

# makeadir - make a directory with specified owner, group and mode
# $Id: makeadir.sh,v 1.2 2001/08/28 15:22:24 remstats Exp $

# Copyright 1999, 2000 (c) Thomas Erskine
# See the COPYRIGHT file with the distribution.

# - - -   Setup   - - -

if [ $# != 4 ] ; then
	echo "usage: $0 owner group mode dir"
	exit 1
fi

owner=$1
group=$2
mode=$3
dir=$4

# - - -   Mainline   - - -

mkdir $dir || \
	(echo "can't mkdir $dir" ; exit 2)
chown $owner $dir || \
	(echo "can't chown $dir" ; exit 2)
chgrp $group $dir || \
	(echo "can't chgrp $dir" ; exit 2)
chmod $mode $dir || \
	(echo "can't chmod $dir" ; exit 2)

exit 0