-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextractSpecs.sh
executable file
·51 lines (45 loc) · 1.01 KB
/
extractSpecs.sh
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
function show_help
{
echo ""
echo "-------------------------------------------------------"
echo "This program extracts gain, f3dB and power usage from"
echo "a spice file"
echo "Usage: `basename $0` -i FILENAME.sp"
echo "-------------------------------------------------------"
exit $E_BADARGS
}
function extract
{
hspice $FILENAME > ${FILENAME%.*}.lis
cat ${FILENAME%.*}.lis | grep gainmax
cat ${FILENAME%.*}.lis | grep f3db
cat ${FILENAME%.*}.lis | grep watts
}
if [ $# == 0 ]
then
show_help
exit $E_BADARGS
fi
if [ $# == 1 ]
then
FILENAME=$1
extract
exit 0
fi
while [[ $1 == -* ]]; do
case "$1" in
-h|--help|-\?) show_help; exit 0;;
-v|--verbose) verbose=1; shift;;
-i) if (($# > 1)); then
FILENAME=$2; shift 2
else
echo "-i requires an input spice file. e.g. file.sp" 1>&2
exit $E_BADARGS
fi ;;
--) shift; break;;
-*) echo "invalid option: $1" 1>&2; show_help; exit $E_BADARGS;;
esac
done
extract
exit 0