Skip to content

Commit 414ec62

Browse files
committed
Add bash strict mode to scripts
1 parent 8ad51f6 commit 414ec62

15 files changed

+24
-9
lines changed

easy_setup/deleteTRAL.sh

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#provide paths from config file (has to be in the same directory than setupTRAL.sh)
1212
. configTRAL_path.cfg
1313
shopt -s nocasematch # making comparisons case-insensitive
14+
set -euo pipefail # exit on errors and undefined vars
1415

1516
######################
1617
### Delete TRAL

easy_setup/install_ext_software.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@
1010
#provide paths from config file (has to be in the same directory than setupTRAL.sh)
1111
. configTRAL_path.cfg
1212
shopt -s nocasematch # making comparisons case-insensitive
13+
set -euo pipefail # exit on errors and undefined vars
1314

1415
######################
1516
### Installing external software
1617

1718

1819
install_ext_software () {
1920

20-
if [[ "$ACCEPT_ALL" = "yes" ]]; then
21+
if [[ "${ACCEPT_ALL:-no}" = "yes" ]]; then
2122
y=y
2223
else read -p "Would you like to install "$(basename "${software%%.sh}")"? Type \"y\" if YES:" y
2324
fi
@@ -36,7 +37,7 @@ install_ext_software () {
3637

3738
}
3839

39-
if [[ "$ACCEPT_ALL" = "yes" ]]; then
40+
if [[ "${ACCEPT_ALL:-no}" = "yes" ]]; then
4041
yn=y
4142
else read -p "Would you like to install any external software? yes(y) or no (n):" yn
4243
fi

easy_setup/install_ext_software/alf.sh

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
### Housekeeping
1515

1616
shopt -s nocasematch # making comparisons case-insensitive
17+
set -euo pipefail # exit on errors and undefined vars
1718

1819
PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; cd .. ; pwd -P ) # other files are located one directory above
1920
. "$PARENT_PATH/configTRAL_path.cfg" || { # provide paths from config file

easy_setup/install_ext_software/hhrepid.sh

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
### Housekeeping
4141

4242
shopt -s nocasematch # making comparisons case-insensitive
43+
set -euo pipefail # exit on errors and undefined vars
4344

4445
PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; cd .. ; pwd -P ) # other files are located one directory above
4546
. "$PARENT_PATH/configTRAL_path.cfg" || { # provide paths from config file

easy_setup/install_ext_software/hmmer.sh

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
### Housekeeping
1616

1717
shopt -s nocasematch # making comparisons case-insensitive
18+
set -euo pipefail # exit on errors and undefined vars
1819

1920
PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; cd .. ; pwd -P ) # other files are located one directory above
2021
. "$PARENT_PATH/configTRAL_path.cfg" || { # provide paths from config file

easy_setup/install_ext_software/mafft.sh

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
### Housekeeping
2121

2222
shopt -s nocasematch # making comparisons case-insensitive
23+
set -euo pipefail # exit on errors and undefined vars
2324

2425
PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; cd .. ; pwd -P ) # other files are located one directory above
2526
. "$PARENT_PATH/configTRAL_path.cfg" || { # provide paths from config file

easy_setup/install_ext_software/not_supported/tred.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
### Housekeeping
3535

3636
shopt -s nocasematch # making comparisons case-insensitive
37+
set -euo pipefail # exit on errors and undefined vars
3738

3839
PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; cd .. ; pwd -P ) # other files are located one directory above
3940
. "$PARENT_PATH/configTRAL_path.cfg" || { # provide paths from config file
@@ -45,7 +46,7 @@ PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; cd .. ; pwd -P ) # other fi
4546
while [ ! -x $(which virtualenv 2>/dev/null) ]; do
4647
echo "Installing virtualenv required by: "${PIP:-pip}" install virtualenv."
4748

48-
if [[ "$ACCEPT_ALL" = "yes" ]]; then
49+
if [[ "${ACCEPT_ALL:-no}" = "yes" ]]; then
4950
yn=y
5051
else read -p "Do you wish to install this program? yes(y) or no (n):" yn
5152
fi

easy_setup/install_ext_software/not_supported/tredparse.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
### Housekeeping
3535

3636
shopt -s nocasematch # making comparisons case-insensitive
37+
set -euo pipefail # exit on errors and undefined vars
3738

3839
PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; cd .. ; pwd -P ) # other files are located one directory above
3940
. "$PARENT_PATH/configTRAL_path.cfg" || { # provide paths from config file
@@ -45,7 +46,7 @@ PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; cd .. ; pwd -P ) # other fi
4546
while [ ! -x $(which virtualenv 2>/dev/null) ]; do
4647
echo "Installing virtualenv required by: "${PIP:-pip}" install virtualenv."
4748

48-
if [[ "$ACCEPT_ALL" = "yes" ]]; then
49+
if [[ "${ACCEPT_ALL:-no}" = "yes" ]]; then
4950
yn=y
5051
else read -p "Do you wish to install this program? yes(y) or no (n):" yn
5152
fi

easy_setup/install_ext_software/phobos.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
### Housekeeping
1818

1919
shopt -s nocasematch # making comparisons case-insensitive
20+
set -euo pipefail # exit on errors and undefined vars
2021

2122
PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; cd .. ; pwd -P ) # other files are located one directory above
2223
. "$PARENT_PATH/configTRAL_path.cfg" || { # provide paths from config file
@@ -31,7 +32,7 @@ PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; cd .. ; pwd -P ) # other fi
3132

3233
if [ ! -x "$(command -v phobos_64_libstdc++6)" ]; then # test if not already in directory
3334

34-
if [[ "$ACCEPT_ALL" = "yes" ]]; then
35+
if [[ "${ACCEPT_ALL:-no}" = "yes" ]]; then
3536
ma=a
3637
else
3738
{
@@ -56,7 +57,7 @@ if [ ! -x "$(command -v phobos_64_libstdc++6)" ]; then # test if not already in
5657
[Aa]* )
5758
echo -e "\nDo you confirm to the authors copyright (Copyright (c) Christoph Mayer 2006-2017)?\n This program is for academic and non-commercial usage only."
5859

59-
if [[ "$ACCEPT_ALL" = "yes" ]]; then
60+
if [[ "${ACCEPT_ALL:-no}" = "yes" ]]; then
6061
yn=y
6162
else read -p "Would you like to download the phobos-v3.3.12-linux version? yes(y) or no (n):" yn
6263
fi

easy_setup/install_ext_software/treks.sh

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
### Housekeeping
1212

1313
shopt -s nocasematch # making comparisons case-insensitive
14+
set -euo pipefail # exit on errors and undefined vars
1415

1516
PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; cd .. ; pwd -P ) # other files are located one directory above
1617
. "$PARENT_PATH/configTRAL_path.cfg" || { # provide paths from config file

easy_setup/install_ext_software/trf.sh

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
### Housekeeping
2020

2121
shopt -s nocasematch # making comparisons case-insensitive
22+
set -euo pipefail # exit on errors and undefined vars
2223

2324
PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; cd .. ; pwd -P ) # other files are located one directory above
2425
. "$PARENT_PATH/configTRAL_path.cfg" || { # provide paths from config file

easy_setup/install_ext_software/trust.sh

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
### Housekeeping
1313

1414
shopt -s nocasematch # making comparisons case-insensitive
15+
set -euo pipefail # exit on errors and undefined vars
1516

1617
PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; cd .. ; pwd -P ) # other files are located one directory above
1718
. "$PARENT_PATH/configTRAL_path.cfg" || { # provide paths from config file

easy_setup/install_ext_software/xstream.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
### Housekeeping
1616

1717
shopt -s nocasematch # making comparisons case-insensitive
18-
18+
set -euo pipefail # exit on errors and undefined vars
19+
1920
PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; cd .. ; pwd -P ) # other files are located one directory above
2021
. "$PARENT_PATH/configTRAL_path.cfg" || { # provide paths from config file
2122
echo "configTRAL_path.cfg not found"

easy_setup/setupTRAL.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
######################
1111

1212
shopt -s nocasematch # making comparisons case-insensitive
13+
set -euo pipefail # exit on errors and undefined vars
1314

1415
if [[ ! "$1" =~ ^(setup|pip)$ ]]; then
1516
echo -e "\nPlease provide as argument how you want to install TRAL with setup.py \"setup\" or \"pip\").\n"
@@ -61,7 +62,7 @@ if [[ $1 == "setup" ]]; then
6162
# if the tral directory is not already downloaded, it has to be cloned from github
6263
echo -e "\nPlease clone the TRAL repository from github.\n"
6364

64-
if [[ "$ACCEPT_ALL" = "yes" ]]; then
65+
if [[ "${ACCEPT_ALL:-no}" = "yes" ]]; then
6566
yn=y
6667
else read -p "Do you want to clone the TRAL repository from github in "$TRAL_PATH"? yes(y) or no (n):" yn
6768
fi
@@ -126,7 +127,7 @@ fi
126127
if [ ! -d "$TRAL_CONF/data/pvalue" ]; then
127128
echo -e "\nIn order to calculate the p-Value of tandem repeat scores, available p-Value distributions need to be downloaded (2.6Gb) and placed in ~/.tral/data/pvalue."
128129

129-
if [[ "$ACCEPT_ALL" = "yes" ]]; then
130+
if [[ "${ACCEPT_ALL:-no}" = "yes" ]]; then
130131
yn=y
131132
else read -p "Would you like to do this? yes(y) or no (n):" yn
132133
fi

easy_setup/uninstall_all_ext_software.sh

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#provide paths from config file (has to be in the same directory than setupTRAL.sh)
1616
. configTRAL_path.cfg
1717
shopt -s nocasematch # making comparisons case-insensitive
18+
set -euo pipefail # exit on errors and undefined vars
1819

1920

2021
######################

0 commit comments

Comments
 (0)