-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.sh
More file actions
executable file
·44 lines (35 loc) · 1.09 KB
/
Copy pathbasic.sh
File metadata and controls
executable file
·44 lines (35 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Check if correct number of arguments provided
if [ $# -ne 2 ]; then
echo "Usage: $0 <input_file> <output_file>"
echo "Example: $0 data/input/in1.txt data/output/out1.txt"
exit 1
fi
# Check if input file exists
if [ ! -f "$1" ]; then
echo "Error: Input file '$1' does not exist."
exit 1
fi
# Initialize environment by sourcing the setup script in the current shell context.
# This ensures that any environment variables, virtual environment activation,
# or dependency setup performed in setup.sh are available to subsequent commands.
source ./setup.sh
if [ $? -ne 0 ]; then
echo "Error: Failed to set up environment."
exit 1
fi
# Create output directory if it doesn't exist
output_dir=$(dirname "$2")
mkdir -p "$output_dir"
# Execute the Python pipeline in "basic" mode.
# Arguments:
# $1 - Path to the input file
# $2 - Path to the output file
echo "Running basic algorithm..."
python3 src/main.py basic "$1" "$2"
exit_code=$?
# Explicitly deactivate the virtual environment if it's active
if [[ "$VIRTUAL_ENV" != "" ]]; then
deactivate
fi
exit $exit_code