50 lines
749 B
Bash
Executable File
50 lines
749 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# The following block allows to use the `run` script like this
|
|
# ```
|
|
# ln -s run a_script.sh
|
|
# ./a_script.sh
|
|
# ```
|
|
# which then runs `./run a_script.py`
|
|
|
|
fn=$(basename $0)
|
|
if [ "$fn" != "run" ]; then
|
|
dn=$(dirname "$0")
|
|
sn=$(basename "$0" .sh)
|
|
dn="${dn}/run"
|
|
sn="${sn}.py"
|
|
echo "Running: $dn $sn"
|
|
$dn $sn
|
|
exit
|
|
fi
|
|
|
|
###
|
|
|
|
function help() {
|
|
echo "Load conda env and run a script"
|
|
echo
|
|
echo "usage: $0 a_script.py"
|
|
}
|
|
|
|
while getopts ":h" option; do
|
|
case $option in
|
|
h)
|
|
help
|
|
exit 1;;
|
|
\?)
|
|
help
|
|
exit 1;;
|
|
esac
|
|
done
|
|
|
|
if [[ -z $@ ]]; then
|
|
help
|
|
exit 1
|
|
fi
|
|
|
|
source /sf/alvra/applications/miniconda3/etc/profile.d/conda.sh
|
|
conda activate adaq
|
|
source /sf/eido/source-python
|
|
$@
|
|
|