Files
smom-dbis-138/scripts/automation/standardize-shebangs.sh

22 lines
579 B
Bash
Raw Normal View History

#!/usr/bin/env bash
# Standardize script shebangs
# Converts #!/bin/bash to #!/usr/bin/env bash for better portability
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
cd "$PROJECT_ROOT"
count=0
while IFS= read -r -d '' file; do
if head -1 "$file" | grep -q "^#!/bin/bash"; then
sed -i '1s|#!/bin/bash|#!/usr/bin/env bash|' "$file"
((count++)) || true
fi
done < <(find scripts -name "*.sh" -type f -print0)
echo "✅ Standardized $count scripts to use #!/usr/bin/env bash"