async function getShellFromCommand(shellPath = null) {
  try {
    let command = 'echo $0';
    
    // Use different commands for Windows shells
    if (shellPath === 'cmd' || shellPath === 'cmd.exe') {
      command = 'echo %0';
    } else if (shellPath === 'pwsh' || shellPath === 'powershell') {
      command = 'Write-Host $MyInvocation.MyCommand.Name';
    }
    
    const result = await executeCommand(command, 2000);
    
    // Extract shell name from the result
    if (result.content && result.content[0] && result.content[0].text) {
      const output = result.content[0].text;
      // Look for the shell name in the output, handling both PID line and actual output
      const lines = output.split('\n').filter(line => line.trim() !== '');
      
      // Find the line that contains the actual shell output (not the PID line, Command started, or Initial output)
      for (const line of lines) {
        if (!line.includes('PID') && 
            !line.includes('Command started') && 
            !line.includes('Initial output:') &&
            line.trim() !== '') {
          return line.trim();
        }
      }
    }
    
    throw new Error('Could not extract shell name from command output');
  } catch (error) {
    console.error('Error executing shell command:', error);
    throw error;
  }
}
Execute echo $0 command and extract the shell name from the output
For Windows shells, use appropriate commands