test-claude-noninteractive.sh 775 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. # Test script to verify Claude runs in non-interactive mode
  3. echo "Testing Claude in non-interactive mode..."
  4. echo "Starting at: $(date)"
  5. echo ""
  6. # Add claude to PATH
  7. export PATH="$HOME/.local/bin:$PATH"
  8. # Simple test prompt
  9. TEST_PROMPT="Please respond with 'Hello from non-interactive mode!' and nothing else."
  10. echo "Running: claude --print --dangerously-skip-permissions \"$TEST_PROMPT\""
  11. echo "---"
  12. # Run Claude and capture output
  13. OUTPUT=$(claude --print --dangerously-skip-permissions "$TEST_PROMPT" 2>&1)
  14. EXIT_CODE=$?
  15. echo "$OUTPUT"
  16. echo "---"
  17. echo "Exit code: $EXIT_CODE"
  18. echo "Completed at: $(date)"
  19. if [ $EXIT_CODE -eq 0 ]; then
  20. echo "✓ SUCCESS: Claude ran non-interactively"
  21. else
  22. echo "✗ FAILED: Claude exited with code $EXIT_CODE"
  23. fi