Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
AllenDowney
GitHub Repository: AllenDowney/ModSimPy
Path: blob/master/modsim/build.sh
921 views
1
#!/bin/sh
2
3
# Exit on any error
4
set -e
5
6
# Get the directory where this script is located
7
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
8
CANONICAL_FILE="$SCRIPT_DIR/modsim.py"
9
10
# Function to copy if destination exists
11
copy_if_exists() {
12
dest="$1"
13
if [ -f "$dest" ]; then
14
echo "Copying to $dest"
15
cp "$CANONICAL_FILE" "$dest"
16
fi
17
}
18
19
# Copy to root directory
20
copy_if_exists "$SCRIPT_DIR/../modsim.py"
21
22
# Copy to chapters directory
23
copy_if_exists "$SCRIPT_DIR/../chapters/modsim.py"
24
25
# Copy to examples directory
26
copy_if_exists "$SCRIPT_DIR/../examples/modsim.py"
27
28
# Copy to ModSimPySolutions directory and its subdirectories
29
copy_if_exists "$SCRIPT_DIR/../ModSimPySolutions/modsim.py"
30
copy_if_exists "$SCRIPT_DIR/../ModSimPySolutions/examples/modsim.py"
31
copy_if_exists "$SCRIPT_DIR/../ModSimPySolutions/chapters/modsim.py"
32
33
echo "Done copying modsim.py to all locations"
34