#!/bin/bash [ ! "$1" ] && { echo "makemodule: create a new module in src/" echo "$0 " exit 1 } [ -e "$1.c" -o -e "$1.c" ] && { echo "module $1 already exists, so I refuse to overwrite it" exit 1 } upper=$(echo $1 | tr "[:lower:]" "[:upper:]") cat >$1.h <<-EOT #ifndef __${upper}_H__ #define __${upper}_H__ // TODO: insert code here #endif /*__${upper}_H__*/ EOT cat >$1.c <<-EOT #include "common.h" #include "$1.h" /////////////////////////////////////////////////////////////////////////////// int _test_$1(int argc, char *argv[]) { printf("Nothing to test in $1.\n"); return 0; } EOT