File: createdirectory

package info (click to toggle)
ctn 3.2.0~dfsg-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,936 kB
  • sloc: ansic: 179,652; makefile: 7,007; java: 1,863; csh: 1,067; yacc: 523; sh: 424; cpp: 394; sql: 389; lex: 170
file content (25 lines) | stat: -rw-r--r-- 475 bytes parent folder | download | duplicates (6)
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
#!/bin/csh
#
# This script is to guarantee that a directory exists.  It will only
# make a new directory at the last level in a hierarchy, so don't
# expect it to go down a full path.
#
# Usage: createdirectory <directory>

if ($1 == "") then
  echo "Usage: createdirectory <directory>"
  exit 1
endif

if (-e $1) then
exit 0
endif

#echo Directory $1 does not exist.  Trying to create $1.
mkdir -m 775 $1

if ($status != 0) then
echo Unable to create $1
endif

exit $status