File: historization_feature

package info (click to toggle)
dar 2.8.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,024 kB
  • sloc: cpp: 86,219; sh: 6,978; ansic: 895; makefile: 489; python: 242; csh: 115; perl: 43; sed: 16
file content (36 lines) | stat: -rwxr-xr-x 589 bytes parent folder | download | duplicates (4)
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
33
34
35
36
#!/bin/bash

if [ -z "$1" -o -z "$2" ] ; then
    echo "usage: $0 <dir> {phase1 | phase2}"
    exit 1
fi

dir="$1"
phase="$2"

case "$phase" in
    phase1)
	if [ -e "$dir" ] ; then
	    echo "$dir exists, remove it first"
	    exit 2
	fi
	mkdir "$dir"
	echo "Hello World!" > "$dir/A.txt"
	echo "Bonjour tout le monde !" > "$dir/B.txt"
    ;;
    phase2)
	if [ ! -d "$dir" ] ; then
	    echo "$dir does not exist or is not a directory, run phase1 first"
	    exit 2
	fi

	rm -f "$dir/A.txt"
	echo "Buongiorno a tutti !" > "$dir/C.txt"
    ;;
    *)
	echo "unknown phase"
	exit 2
	;;
esac