Initial commit. Files as-is. Currently chertex.sh and simpledelay.sh are most used.
commit
0745dbe501
@ -0,0 +1,4 @@
|
|||||||
|
biber
|
||||||
|
pdfcrop
|
||||||
|
unborn/
|
||||||
|
documentation/
|
@ -0,0 +1,180 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Umbrella function to simplify use of pdftk
|
||||||
|
# Created April 20, 2010
|
||||||
|
# Taha Ahmed, taha@chepec.se
|
||||||
|
# **************************
|
||||||
|
# Usage:
|
||||||
|
# ARG 1: filename of pdf, e.g., 'oxides.pdf'
|
||||||
|
# ARG 2: specify operation,
|
||||||
|
# - 'dump_data' --> writes metadata to $reportfile in current directory
|
||||||
|
# ARG 3: used when updating metadata, specifies the input text file
|
||||||
|
|
||||||
|
# $* Stores all the arguments that were entered on the command line ($1 $2 ...).
|
||||||
|
# $@ Stores all the arguments that were entered on the command line, individually quoted ("$1" "$2" ...).
|
||||||
|
# -o is logical OR - can be evaluated within single brackets
|
||||||
|
# -a is logical AND - can be evaluated within single brackets
|
||||||
|
|
||||||
|
#############################################################
|
||||||
|
## Original pdftk syntax
|
||||||
|
## *********************
|
||||||
|
## Dump metadata to file
|
||||||
|
#= pdftk <in.pdf> dump_data output <$reportfile>
|
||||||
|
## Update metadata from file
|
||||||
|
#= pdftk <in.pdf> update_info <$reportfile> output <out.pdf>
|
||||||
|
#############################################################
|
||||||
|
|
||||||
|
# Perhaps good to save original PDF
|
||||||
|
|
||||||
|
# Could be nice to be able to input metadata updates directly at the bash prompt, something like
|
||||||
|
# First, script displays current fields
|
||||||
|
# echo Which field do you want to update/create?
|
||||||
|
# echo <Display choice as a list>
|
||||||
|
# read choice newfieldinfo
|
||||||
|
# do the whole pdftk update stuff
|
||||||
|
# voila!
|
||||||
|
|
||||||
|
#set -x # for debugging
|
||||||
|
|
||||||
|
NAME=$(basename $0)
|
||||||
|
echo "***********************************************************"
|
||||||
|
echo "This is $NAME. Write $NAME -h for help."
|
||||||
|
|
||||||
|
# Set defaults
|
||||||
|
DUMPMETADATA=yes # default action
|
||||||
|
UPDATEMETADATA=no
|
||||||
|
|
||||||
|
# Set filetypes
|
||||||
|
pdfext=".pdf"
|
||||||
|
metadataext=".pdfmeta"
|
||||||
|
|
||||||
|
usage () {
|
||||||
|
cat <<EOF
|
||||||
|
NAME
|
||||||
|
$NAME - Wraps pdftk in a personalised run environment.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
$NAME [OPTION], or
|
||||||
|
$NAME [FILENAME.PDF]
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
The following options can be used:
|
||||||
|
|
||||||
|
-h, --help
|
||||||
|
Displays this help text.
|
||||||
|
|
||||||
|
If no option nor filename is specified, the script defaults to
|
||||||
|
dumping metadata information for all PDF files present in the
|
||||||
|
current directory into *.pdfmeta files, one for each PDF.
|
||||||
|
If no PDF files are present in the current directory, the script
|
||||||
|
exits without taking any further action.
|
||||||
|
|
||||||
|
DETAILS
|
||||||
|
|
||||||
|
|
||||||
|
EXAMPLE
|
||||||
|
Extract metadata for all PDFs in directory and dump into separate files
|
||||||
|
$NAME -a
|
||||||
|
|
||||||
|
Default usage - dump PDF metadata in <filename>.pdfmeta
|
||||||
|
$NAME <filename>.pdf
|
||||||
|
|
||||||
|
AUTHOR
|
||||||
|
Taha Ahmed <taha.ahmed at mkem.uu.se>
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
OPTIONS=$@
|
||||||
|
|
||||||
|
for OPTION in "$@"; do
|
||||||
|
case "$OPTION" in
|
||||||
|
-h | --help )
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-a | --all )
|
||||||
|
# Perform default action on all PDFs in current directory
|
||||||
|
|
||||||
|
;;
|
||||||
|
* ) # no options, just run with default settings
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
FILES=$OPTIONS
|
||||||
|
|
||||||
|
# Check if no input files were given
|
||||||
|
if [ ! -n "$FILES" ]; then
|
||||||
|
# Perhaps do default action for all pdf files in current directory?
|
||||||
|
echo -e "\nError: There is no input files! Usage is:\n"
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check file types (pre-assumes a file extension exists)
|
||||||
|
for FILE in "$FILES"; do
|
||||||
|
PDFFILE=$(echo $FILE | grep '.[Pp][Dd][Ff]$')
|
||||||
|
TEXFILE=$(echo $FILE | grep '.[Tt][Ee][Xx]$')
|
||||||
|
if [ ! -n "$PDFFILE" -a ! -n "$TEXFILE" ]; then
|
||||||
|
echo "$FILE is not a supported file type!"
|
||||||
|
echo "It should be one of: .pdf or .tex"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
NEWFILES="$NEWFILES $FILE"
|
||||||
|
unset PDFFILE TEXFILE
|
||||||
|
done
|
||||||
|
FILES=$NEWFILES
|
||||||
|
|
||||||
|
# Execution
|
||||||
|
for FILE in "$FILES"; do
|
||||||
|
# Metadata filename is pdf basename plus .pdfmeta extension
|
||||||
|
METADATAFILE=${FILE%.*}$metadataext # metadata filename
|
||||||
|
|
||||||
|
if [ "$DUMPMETADATA" = "yes" ]; then
|
||||||
|
#echo "pdftk $FILE dump_data output $METADATAFILE"
|
||||||
|
|
||||||
|
## It seems pdftk has problems dealing with spaces in filenames or paths.
|
||||||
|
## Possible work-arounds:
|
||||||
|
## Escape spaces with back-slashes?
|
||||||
|
## Check for spaces in filename, if present, copy to temporary file without spaces,
|
||||||
|
## then run call pdftk, then rename again...
|
||||||
|
|
||||||
|
pdftk $FILE dump_data output $METADATAFILE
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
### STUFF BELOW IS OLD
|
||||||
|
reportfile=./chepdftk-report.txt
|
||||||
|
|
||||||
|
# Check number of args supplied
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
# Zero arguments
|
||||||
|
echo No arguments given.
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
# Some arguments were passed.
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
# One argument was passed
|
||||||
|
echo One argument.
|
||||||
|
else
|
||||||
|
# More than one argument
|
||||||
|
if [ $# -eq 2 ]; then
|
||||||
|
# Two arguments were passed
|
||||||
|
echo Two arguments.
|
||||||
|
if [ $2 == "dump_data" ]; then
|
||||||
|
pdftk $1 $2 output $reportfile
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# More than two arguments
|
||||||
|
if [ $# -eq 3 ]; then
|
||||||
|
# Three arguments were passed
|
||||||
|
echo Three arguments.
|
||||||
|
else
|
||||||
|
# More than three arguments
|
||||||
|
echo More than three arguments. Too many.
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
@ -0,0 +1,149 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
## Process *.Rnw files
|
||||||
|
## Written May 14, 2010
|
||||||
|
## Taha Ahmed
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
# For now, MAKE SURE that the argument consists of
|
||||||
|
# a complete filename, with extension, and
|
||||||
|
# in the directory of the Rnw file
|
||||||
|
####################################################
|
||||||
|
|
||||||
|
clear
|
||||||
|
echo "---------------------------------------------------------------"
|
||||||
|
echo "cheRTeX -- a script for processing R-Sweave-LaTeX-TikZ projects"
|
||||||
|
echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
|
||||||
|
echo "MMX -- taha.ahmed@mkem.uu.se -- CHEPEC doctoral degree project"
|
||||||
|
echo "---------------------------------------------------------------"
|
||||||
|
|
||||||
|
Rfiletype="R"
|
||||||
|
TeXfiletype="tex"
|
||||||
|
tikzfiles="*.tikz"
|
||||||
|
Rnwfiles="*.Rnw"
|
||||||
|
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
# Check if the argument contains a filetype
|
||||||
|
# Assumes a complete filename was passed
|
||||||
|
jobfilename=$1
|
||||||
|
jobfiletype=${jobfilename#*.} # File extension
|
||||||
|
jobname=${jobfilename%.*} # Filename without extension part
|
||||||
|
|
||||||
|
echo "<cheRTeX> Detected filename: " $jobname
|
||||||
|
echo "<cheRTeX> Detected extension:" $jobfiletype
|
||||||
|
|
||||||
|
# Verifying that the file extension is *.Rnw
|
||||||
|
if [[ $jobfiletype == "Rnw" || $jobfiletype == "rnw" || $jobfiletype == "RNW" ]]; then
|
||||||
|
# File extension is *.Rnw
|
||||||
|
echo "<cheRTeX> Detected *.Rnw extension"
|
||||||
|
jobfiletype="Rnw"
|
||||||
|
else
|
||||||
|
# File extension is not *.Rnw
|
||||||
|
echo "<cheRTeX> File extension should be *.Rnw"
|
||||||
|
echo "<cheRTeX> Terminating..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Introducing a short delay to enable on-screen reading of previous echo
|
||||||
|
simpledelay.sh 2
|
||||||
|
echo "Delay completed"
|
||||||
|
|
||||||
|
# Tangle
|
||||||
|
echo "<cheRTeX> Tangling..."
|
||||||
|
R CMD Stangle $jobname.$jobfiletype
|
||||||
|
# Weave
|
||||||
|
echo "<cheRTeX> Weaving..."
|
||||||
|
R CMD pgfsweave --graphics-only $jobname.$jobfiletype
|
||||||
|
|
||||||
|
# Introduce delay to give time to read R CMD exit status
|
||||||
|
echo "<cheRTeX> -------------------------"
|
||||||
|
echo "<cheRTeX> R CMD pgfsweave completed"
|
||||||
|
echo "<cheRTeX> -------------------------"
|
||||||
|
simpledelay.sh 5
|
||||||
|
|
||||||
|
# Run vc script if vc exists in working directory
|
||||||
|
echo "<cheRTeX> Running vc script"
|
||||||
|
if [ -f vc ]; then
|
||||||
|
./vc
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run pdflatex, bibtex, and company
|
||||||
|
echo "<cheRTeX> Calling LaTeXMK"
|
||||||
|
latexmk $jobname -pdf -bibtex
|
||||||
|
|
||||||
|
# Don't bother with this. Let latexmk take care of cleaning up
|
||||||
|
# Move unnecessary auxiliary files generated
|
||||||
|
#echo "<cheRTeX> _________________________"
|
||||||
|
#echo "<cheRTeX> ========================="
|
||||||
|
#echo "<cheRTeX> Moving auxiliary files..."
|
||||||
|
#mv *.aux logs
|
||||||
|
#mv *.log logs
|
||||||
|
#mv *.out logs
|
||||||
|
else
|
||||||
|
# Either no arguments, or more than one argument
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
# Zero arguments. Present a menu of choices
|
||||||
|
echo "This is cheRTeX POST-PROCESSING" # only one choice for now
|
||||||
|
echo "<1> 'pdf-all' -- Process all .tikz files to pdf graphics"
|
||||||
|
echo "Any other input exits the program"
|
||||||
|
read usrchoice
|
||||||
|
|
||||||
|
# Determine number of .Rnw files in current directory
|
||||||
|
Rnwfileno=$(ls -1 $Rnwfiles | wc -l)
|
||||||
|
echo "No of .Rnw files: $Rnwfileno"
|
||||||
|
|
||||||
|
# Check if number of .Rnw files larger than one
|
||||||
|
if [ $Rnwfileno -gt 1 ]; then
|
||||||
|
# If larger than one, ask for user input
|
||||||
|
# Indicates more than one Rnw file in current directory.
|
||||||
|
# This introduces a naming ambiguity.
|
||||||
|
# Resolve by asking user for current jobname
|
||||||
|
echo "Found $Rnwfileno .Rnw files in current directory"
|
||||||
|
echo "Please specify the jobname"
|
||||||
|
read jobname
|
||||||
|
if [ -z "$jobname" ]; then
|
||||||
|
# string is null
|
||||||
|
echo "Specified jobname cannot be parsed. Terminating..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Else, fetch the jobname from the .Rnw filename by stripping file extension
|
||||||
|
Rnwfilename=$(ls -1 $Rnwfiles)
|
||||||
|
jobname=${Rnwfilename%.*}
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Jobname set to: $jobname"
|
||||||
|
|
||||||
|
if [[ $usrchoice == "pdf-all" || $usrchoice == "1" ]]; then
|
||||||
|
echo "<1> 'pdf-all' chosen"
|
||||||
|
# This for loop ONLY USED to determine number of *.tikz files in directory
|
||||||
|
for tikzfiles in "$tikzfiles"; do tikzfilenumber=${#tikzfiles}; done
|
||||||
|
echo "cheRTeX detected $tikzfilenumber TikZ files for processing"
|
||||||
|
echo "Starting TikZ file processing..."
|
||||||
|
simpledelay.sh 2
|
||||||
|
|
||||||
|
for tikzfilename in $tikzfiles; do
|
||||||
|
# Remove the file extension
|
||||||
|
tikzlabel=${tikzfilename%.*}
|
||||||
|
# Call pdfLaTeX with tikz label as jobname # See TiKZ manual section 63 for more details
|
||||||
|
echo "Executing <pdflatex --jobname=$tikzlabel $jobname.$TeXfiletype>"
|
||||||
|
pdflatex --jobname=$tikzlabel $jobname.$TeXfiletype
|
||||||
|
done
|
||||||
|
echo "Completed TikZ file processing"
|
||||||
|
fi
|
||||||
|
echo "Terminating..."
|
||||||
|
|
||||||
|
mv $jobname-*.pdf tikz-pdfs
|
||||||
|
mv *.aux logs
|
||||||
|
mv *.log logs
|
||||||
|
mv *.out logs
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "<cheRTeX> This script can be run with one argument is process mode,"
|
||||||
|
echo "<cheRTeX> or with zero arguments in post-processing mode."
|
||||||
|
echo "<cheRTeX> Terminating..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 1
|
@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
## This is a shell for running pdflatex and bibtex on TeX files.
|
||||||
|
## Written Apr 29, 2010
|
||||||
|
## Taha Ahmed
|
||||||
|
|
||||||
|
#####
|
||||||
|
## Supply the filename argument without file extension!
|
||||||
|
|
||||||
|
if [ $# -gt 2 ]; then
|
||||||
|
# More than two arguments
|
||||||
|
echo More than two arguments. Too many!
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
# Two or less arguments
|
||||||
|
if [ $# -eq 2 ]; then
|
||||||
|
# Exactly two arguments
|
||||||
|
# First argument should be jobname
|
||||||
|
jobname=$1
|
||||||
|
# Test second argument
|
||||||
|
if [ $2 == "-bib" ]; then
|
||||||
|
BibliographyRequired=1
|
||||||
|
fi
|
||||||
|
if [ $2 == "-biber" ]; then
|
||||||
|
BiberRequired=1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
# Only one argument
|
||||||
|
# Argument specifies the jobname
|
||||||
|
jobname=$1
|
||||||
|
# Set BibliographyRequired to false
|
||||||
|
BibliographyRequired=0
|
||||||
|
else
|
||||||
|
# No arguments submitted
|
||||||
|
# No use right now
|
||||||
|
echo No arguments submitted.
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
pdflatex $jobname
|
||||||
|
if [ $BibliographyRequired ]; then
|
||||||
|
bibtex $jobname
|
||||||
|
fi
|
||||||
|
if [ $BiberRequired ]; then
|
||||||
|
biber $jobname
|
||||||
|
fi
|
||||||
|
pdflatex $jobname
|
||||||
|
pdflatex $jobname
|
@ -0,0 +1,87 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Using two digits the represent the value being counted down
|
||||||
|
# Two-digits set in decimal representation used by printf
|
||||||
|
# Usage: 'countdown #delay #style'
|
||||||
|
# Delay is an integer from 1 to 99 (what happens if zero?)
|
||||||
|
# Style is a string, either "numbers" or "style"
|
||||||
|
# Arguments should always be given in that order
|
||||||
|
# Both arguments may be omitted, in that case delay defaults to ten seconds and style to "numbers"
|
||||||
|
|
||||||
|
defaultdelay=10
|
||||||
|
numberstyle="numbers"
|
||||||
|
symbolstyle="symbols"
|
||||||
|
defaultstyle=$numberstyle
|
||||||
|
|
||||||
|
if [ $# -gt 2 ]; then
|
||||||
|
# More than two arguments
|
||||||
|
echo Too many arguments
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
# Two or less arguments
|
||||||
|
if [ $# -eq 2 ]; then
|
||||||
|
# Exactly two arguments
|
||||||
|
# First argument should specify the delay
|
||||||
|
delaysecs=$1
|
||||||
|
# Second argument should specify the display style
|
||||||
|
style=$2
|
||||||
|
else
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
# Only one argument
|
||||||
|
# Argument specifies the delay
|
||||||
|
delaysecs=$1
|
||||||
|
# Style defaults to "numbers"
|
||||||
|
style="numbers"
|
||||||
|
else
|
||||||
|
# No arguments submitted
|
||||||
|
# Delay defaults
|
||||||
|
delaysecs=$defaultdelay
|
||||||
|
# Style defaults
|
||||||
|
style=$defaultstyle
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Adjustment by one second
|
||||||
|
#delaysecs=$[$delaysecs-1]
|
||||||
|
delaystatic=$delaysecs
|
||||||
|
|
||||||
|
if [ $style == $numberstyle ]; then
|
||||||
|
while [ $delaysecs -gt 0 ]
|
||||||
|
do
|
||||||
|
sleep 1 &
|
||||||
|
printf "\r"
|
||||||
|
# Text before counter
|
||||||
|
printf "Stand by... "
|
||||||
|
printf "%02d" $[delaysecs]
|
||||||
|
delaysecs=$[$delaysecs-1]
|
||||||
|
wait
|
||||||
|
done
|
||||||
|
# Printing the zero (end of count-down)
|
||||||
|
printf "\b\b"
|
||||||
|
printf "%02d" $[delaysecs]
|
||||||
|
printf " - Done!"
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
# style is symbolstyle
|
||||||
|
printf -v line '%*s' "$delaysecs"
|
||||||
|
printf "%s\r" "${line// /#}"
|
||||||
|
while [ $delaysecs -gt 0 ]
|
||||||
|
do
|
||||||
|
sleep 1 &
|
||||||
|
printf "+"
|
||||||
|
delaysecs=$[$delaysecs-1]
|
||||||
|
wait
|
||||||
|
done
|
||||||
|
#printf "\b "
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Bash quoting with ANSI-C style
|
||||||
|
# \b - backspace
|
||||||
|
# \r - carriage return
|
||||||
|
# \n - newline
|
||||||
|
# \f - form-feed
|
||||||
|
# \t - horizontal tabulator
|
||||||
|
# \v - vertical tabulator
|
||||||
|
# http://bash-hackers.org/wiki/doku.php/commands/builtin/printf
|
@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
## Taha Ahmed, Sep 16, 2010
|
||||||
|
|
||||||
|
## For making PDF from LaTeX file that uses PSTricks,
|
||||||
|
## also fixing correct page size using the preview package.
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
# Required argument:
|
||||||
|
# Filename (WITHOUT FILE EXTENSION)
|
||||||
|
####################################################
|
||||||
|
|
||||||
|
##############
|
||||||
|
# Runs
|
||||||
|
# latex
|
||||||
|
# dvips
|
||||||
|
# ps2pdf
|
||||||
|
##############
|
||||||
|
|
||||||
|
|
||||||
|
clear
|
||||||
|
echo "Runs latex, dvips, ps2eps, epstopdf"
|
||||||
|
|
||||||
|
latex $1.tex
|
||||||
|
echo "==============="
|
||||||
|
echo "latex $1.tex"
|
||||||
|
echo "==============="
|
||||||
|
simpledelay.sh 2
|
||||||
|
|
||||||
|
dvips $1.dvi
|
||||||
|
echo "==============="
|
||||||
|
echo "dvips $1.dvi"
|
||||||
|
echo "==============="
|
||||||
|
simpledelay.sh 2
|
||||||
|
|
||||||
|
ps2pdf $1.ps
|
||||||
|
echo "==============="
|
||||||
|
echo "ps2pdf $1.ps"
|
||||||
|
echo "==============="
|
||||||
|
|
||||||
|
exit 1
|
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Arbitrary delay
|
||||||
|
|
||||||
|
# simpledelay.sh <arg>
|
||||||
|
# <arg> is an integer value and specifies the delay interval in seconds
|
||||||
|
|
||||||
|
minint=0 # mininum delay
|
||||||
|
maxint=15 # maximum delay
|
||||||
|
|
||||||
|
# Check that only one argument has been submitted
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
# Check that the argument is an integer and in the valid range
|
||||||
|
if [ $1 ]; then
|
||||||
|
if [ ! $(echo "$1" | grep -E "^[0-9]+$") ]; then
|
||||||
|
echo $1 is not a valid integer.
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
if ! [ $1 -ge $minint ] || ! [ $1 -le $maxint ]; then
|
||||||
|
echo $1 is an invalid value. Range is [$minint-$maxint]
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# No args or more than one submitted
|
||||||
|
echo "<simpledelay.sh> Not a valid numbers of arguments. Only one argument allowed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Execute the delay
|
||||||
|
delaysecs=$1
|
||||||
|
while [ $delaysecs -gt 0 ]; do
|
||||||
|
sleep 1 &
|
||||||
|
delaysecs=$[$delaysecs-1]
|
||||||
|
wait
|
||||||
|
done
|
Loading…
Reference in New Issue