250 |
kaklik |
1 |
#!/bin/bash |
|
|
2 |
# $Id: generator.sh,v 2.0 2003/11/18 15:20:44 nijel Exp $ |
|
|
3 |
# |
|
|
4 |
# Shell script that adds a new function file using a template. Should not be called directly |
|
|
5 |
# but instead by template_Generator.sh and template_generator_mimetype.sh |
|
|
6 |
# |
|
|
7 |
# |
|
|
8 |
# $1: Template |
|
|
9 |
# $2: Filename |
|
|
10 |
# $3: (optional) Description |
|
|
11 |
|
|
|
12 |
if [ $# == 0 ] |
|
|
13 |
then |
|
|
14 |
echo "Please call template_generator.sh or template_generator_mimetype.sh instead" |
|
|
15 |
echo "" |
|
|
16 |
exit 65 |
|
|
17 |
fi |
|
|
18 |
functionupper="`echo $2 | tr [:lower:] [:upper:]`" |
|
|
19 |
functionlower="`echo $2 | tr [:upper:] [:lower:]`" |
|
|
20 |
|
|
|
21 |
cat $1 | sed "s/\[ENTER_FILENAME_HERE\]/$functionupper/" | sed "s/\[enter_filename_here\]/$functionlower/" >> $2.inc.php |
|
|
22 |
|
|
|
23 |
if [ "$3" ] |
|
|
24 |
then |
|
|
25 |
echo "" |
|
|
26 |
echo "To do later:" |
|
|
27 |
echo "cd ../../lang" |
|
|
28 |
echo "./add_message.sh '\$strTransformation_${functionlower}' '$3'" |
|
|
29 |
echo "" |
|
|
30 |
fi |
|
|
31 |
|
|
|
32 |
echo "Created $2.inc.php" |
|
|
33 |
echo "" |