diff --git a/README.md b/README.md index 40c43449b8cf3a407ec2b552c879a1a91ed444c5..5109a119a501cd4a3f70bba270a8328d920e1ed5 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ Run _contig_info_ without option to read the following documentation: -r residue content statistics for each contig sequence instead of global statistics -t tab-delimited output + -h prints this help and exits ``` ## Examples diff --git a/contig_info.sh b/contig_info.sh index a85367337fe582a2aff565b44c7564bdef73c2b7..14a059da4889513b7da3993a717b8d8d1b62187f 100755 --- a/contig_info.sh +++ b/contig_info.sh @@ -32,7 +32,11 @@ # = VERSIONS = # # ============ # # # - VERSION=2.0.210315ac # + VERSION=2.01.210324ac # +# + modified temp file creation using TMPDIR variable # +# + adding option -h # +# # +# VERSION=2.0.210315ac # # + adding option -r # # + adding trap when interrupting script # # # @@ -70,7 +74,7 @@ # ================ # # # # # -if [ "$1" = "-?" ] || [ $# -lt 1 ] +if [ "$1" == "-h" ] || [ $# -lt 1 ] then echo -e "\n\033[1m contig_info v$VERSION $COPYRIGHT\033[0m"; cat <<EOF @@ -86,25 +90,14 @@ then -r residue content statistics for each contig sequence instead of global statistics -t tab-delimited output + -h prints this help and exits EOF - exit ; + [ "$1" == "-h" ] && exit 0 || exit 1 ; fi # # ############################################################################################################# -############################################################################################################# -# # -# ================ # -# = CONSTANTS = # -# ================ # -# # -# = temp directory ======================================================================================= # -# # - TEMP_DIR=${TMPDIR:-/tmp}; -# # -############################################################################################################# - ############################################################################################################# # # # ================ # @@ -112,11 +105,10 @@ fi # ================ # # # # = randomfile() ========================================================================================= # -# returns a random file name within /tmp/ # +# creates a random file within $TEMP_DIR and returns its name # # # randomfile() { - rdmf=$TEMP_DIR/$RANDOM; while [ -e $rdmf ]; do rdmf=$TEMP_DIR/$RANDOM ; done - echo $rdmf ; + echo $(mktemp -t -p ${TMPDIR:-/tmp}) ; } # # #############################################################################################################