Skip to content

Commit

Permalink
shellcheck.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Vyacheslav Brover committed Oct 29, 2024
1 parent 1a6f5db commit 1ee7f56
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion du.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash --noprofile
THIS=`dirname $0`
THIS=$( dirname $0 )
source $THIS/bash_common.sh
if [ $# -ne 1 ]; then
echo "Print total file size in M bytes"
Expand Down
4 changes: 2 additions & 2 deletions grid_wait.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash --noprofile
THIS=`dirname $0`
THIS=$( dirname $0 )
source $THIS/bash_common.sh
if [ $# -ne 1 ]; then
echo "Wait until UGE is available"
Expand All @@ -23,7 +23,7 @@ while true; do
break
fi
sleep 60
N=$(( $N + 1 ))
N=$(( N + 1 ))
done

if [ $N -gt 0 ]; then
Expand Down
4 changes: 2 additions & 2 deletions line.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash --noprofile
THIS=`dirname $0`
THIS=$( dirname $0 )
source $THIS/bash_common.sh
if [ $# -ne 2 ]; then
echo "#1: File name"
Expand All @@ -10,7 +10,7 @@ F=$1
L=$2


N=`cat $F | wc -l`
N=$( cat $F | wc -l )
if [ $L -gt $N ]; then
error "Max. line = $N"
fi
Expand Down
2 changes: 1 addition & 1 deletion make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

unset AT_NCBI

cd `dirname $0`
cd "$( dirname $0 )"
source ./bash_common.sh
export CPP_DIR=$PWD

Expand Down
6 changes: 3 additions & 3 deletions parent_dir.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash --noprofile
THIS=`dirname $0`
THIS=$( dirname $0 )
source $THIS/bash_common.sh
if [ $# -ne 1 ]; then
echo "Print parent directory"
Expand All @@ -8,6 +8,6 @@ fi
F=$1


D=`dirname $F`
P=`realpath $D`
D=$( dirname $F )
P=$( realpath $D )
basename $P
2 changes: 1 addition & 1 deletion phylogeny/distTree_inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ if true; then
fi


VER=$(( $VER + 1 ))
VER=$(( VER + 1 ))
echo $VER > $INC/version

THREADS=$( file2var $INC/threads 15 )
Expand Down
16 changes: 8 additions & 8 deletions qstat_wait.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash --noprofile
THIS=`dirname $0`
THIS=$( dirname $0 )
source $THIS/bash_common.sh
if [ $# -ne 2 ]; then
echo "#1: seconds to wait after all jobs are in 'r' state. 0: resubmit and stop"
Expand All @@ -14,14 +14,14 @@ comment "Waiting for UGE results"


SLEEP_SEC=10 # PAR
PERIODS=$(( $SECS / $SLEEP_SEC ))
PERIODS=$(( SECS / SLEEP_SEC ))


while true; do
sleep $SLEEP_SEC
$THIS/grid_wait.sh 0
set +o errexit
Q=`qstat | grep -v '^job-ID' | grep -v '^---' | grep ' qw ' | wc -l`
Q=$( qstat | grep -v '^job-ID' | grep -v '^---' | grep -c ' qw ' )
set -o errexit
if [ $Q == 0 ]; then
break
Expand All @@ -34,18 +34,18 @@ while true; do
sleep $SLEEP_SEC
$THIS/grid_wait.sh 0
set +o errexit
Q=`qstat | grep -v '^job-ID' | grep -v '^---' | grep -v ' d[tr] ' | wc -l`
Q=$( qstat | grep -v '^job-ID' | grep -v '^---' | grep -vc ' d[tr] ' )
set -o errexit
if [ $Q == 0 ]; then
break
fi

N=$(( $N + 1 ))
N=$(( N + 1 ))
if [ $N -gt $PERIODS ]; then
N=0
$THIS/grid_wait.sh 1
set +o errexit
L=(`qstat | grep -v '^job-ID' | grep -v '^---' | grep -v ' d[tr] ' | grep ' [rTt] ' | sed 's/^ *//1' | cut -f 1 -d ' '`)
L=( $( qstat | grep -v '^job-ID' | grep -v '^---' | grep -v ' d[tr] ' | grep ' [rTt] ' | sed 's/^ *//1' | cut -f 1 -d ' ' ) )
set -o errexit
M=${#L[@]}
if [ $M -ne 0 ]; then
Expand All @@ -56,13 +56,13 @@ while true; do
while [ $i -lt $M ]; do
$THIS/grid_wait.sh 1
qresub ${L[$i]} -h u || true
i=$(($i + 1))
i=$(( i + 1 ))
done
else
warning "Deleting $M UGE jobs"
fi
$THIS/grid_wait.sh 1
qdel -f ${L[@]} || true
qdel -f "${L[@]}" || true
if [ $QRESUB == 1 ]; then
$THIS/grid_wait.sh 1
qrls -h u -u $USER > /dev/null
Expand Down
2 changes: 1 addition & 1 deletion rmBOM.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash --noprofile
THIS=`dirname $0`
THIS=$( dirname $0 )
source $THIS/bash_common.sh
if [ $# -ne 2 ]; then
echo "Remove UTF-8 Byte Order Mark"
Expand Down
4 changes: 2 additions & 2 deletions rm_all.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash --noprofile
THIS=`dirname $0`
THIS=$( dirname $0 )
source $THIS/bash_common.sh
if [ $# -ne 1 ]; then
echo "Delete #1 without 'rm -r' which is slow"
Expand All @@ -14,7 +14,7 @@ if [ ! -e "$DIR" ]; then
fi


TMP=`mktemp -d`
TMP=$( mktemp -d )

rsync -a --delete $TMP/ "$DIR"
rmdir "$DIR"
Expand Down
6 changes: 3 additions & 3 deletions rm_suff.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash --noprofile
THIS=`dirname $0`
THIS=$( dirname $0 )
source $THIS/bash_common.sh
if [ $# -ne 2 ]; then
echo "Remove a suffix from a file name"
Expand All @@ -11,8 +11,8 @@ FILE=$1
SUF=$2


DIR=`dirname $FILE`
OUT=`basename $FILE $SUF`
DIR=$( dirname $FILE )
OUT=$( basename $FILE $SUF )
if [ "$FILE" != "$DIR/$OUT" ]; then
mv $FILE $DIR/$OUT
fi
Expand Down
4 changes: 2 additions & 2 deletions setIntersect.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash --noprofile
THIS=`dirname $0`
THIS=$( dirname $0 )
source $THIS/bash_common.sh
if [ $# -ne 3 ]; then
echo "#1: List1"
Expand All @@ -18,7 +18,7 @@ if [ $NUMP == 1 ]; then
NUM="-number"
fi

TMP=`mktemp`
TMP=$( mktemp )
#comment $TMP
#set -x

Expand Down
4 changes: 2 additions & 2 deletions sort.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash --noprofile
THIS=`dirname $0`
THIS=$( dirname $0 )
source $THIS/bash_common.sh
if [ $# -ne 1 ]; then
echo "#1: File to sort"
exit 1
fi

TMP=`mktemp`
TMP=$( mktemp )
sort $1 > $TMP
mv $TMP $1
2 changes: 1 addition & 1 deletion tar.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash --noprofile
THIS=`dirname $0`
THIS=$( dirname $0 )
source $THIS/bash_common.sh
if [ $# -ne 2 ]; then
echo "tar #1/ into #.tar.gz"
Expand Down
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash --noprofile
THIS=$( realpath $( dirname $0 ) )
THIS=$( realpath "$( dirname $0 )" )
source $THIS/bash_common.sh


Expand Down
4 changes: 2 additions & 2 deletions uniq.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash --noprofile
THIS=`dirname $0`
THIS=$( dirname $0 )
source $THIS/bash_common.sh
if [ $# != 1 ]; then
echo "#1: File to sort and uniq"
exit 1
fi

TMP=`mktemp`
TMP=$( mktemp )
cat $1 | tr '\t' ' ' | sed 's/ *$//1' | sed 's/ / /g' | sort -u | tr ' ' '\t' > $TMP
mv $TMP $1

0 comments on commit 1ee7f56

Please sign in to comment.