File: createdirectory

package info (click to toggle)
ctn 3.2.0~dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 15,336 kB
  • ctags: 21,262
  • sloc: ansic: 179,501; makefile: 7,004; java: 1,863; csh: 1,067; yacc: 523; sh: 424; cpp: 394; sql: 389; lex: 170
file content (25 lines) | stat: -rw-r--r-- 467 bytes parent folder | download | duplicates (9)
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 $1

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

exit $status