#!/usr/bin/env bash
file="/mnt/d/SANDBOX/mygh/learning_ai_devops_tools/install_clis_wsl.sh"
echo "Fixing line endings"
if command -v dos2unix >/dev/null 2>&1; then
  dos2unix "$file"
else
  sed -i 's/\r$//' "$file"
fi

echo
echo "Running syntax check (bash -n)"
if bash -n "$file"; then
  echo "bash syntax: OK"
else
  echo "bash syntax: FAILED"
fi

echo
echo "First 100 lines:"
sed -n '1,100p' "$file"

echo
echo "Byte dump (first 128 bytes):"
if command -v xxd >/dev/null 2>&1; then
  xxd -l 128 "$file"
else
  head -c 128 "$file" | od -An -tx1
fi
