-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgetopts_script_example.sh
More file actions
47 lines (44 loc) · 985 Bytes
/
getopts_script_example.sh
File metadata and controls
47 lines (44 loc) · 985 Bytes
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
#!/usr/bin/env bash
blastfile=
comparefile=
referencegenome=
referenceCDS=
help='''
USAGE: sh lincRNA_pipeline.sh
-c </path/to/cuffcompare_output file>
-g </path/to/reference genome file>
-r </path/to/reference CDS file>
-b </path/to/RNA file>
'''
while getopts ":b:c:g:hr:" opt; do
## Count the opts
let optnum++
case $opt in
b)
blastfile=$OPTARG
echo "$blastfile"
;;
c)
comparefile=$OPTARG
;;
h)
printf "$help"
exit 1
;;
g)
referencegenome=$OPTARG
;;
r)
referenceCDS=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
[[ $opts -lt 3 ]] && echo "At least 3 parameters must be given"