如何在 csh 脚本中制作 if-else

how to make an if-else in csh script

我正在尝试在 csh 脚本中创建一个 if-else,但它不起作用:

你知道为什么这不起作用吗?

if( == "rx" &&  == "2") then
  setenv project_name       "mipi_2_rx_core_ns"
  setenv synth_logfile_name "mipi_2_rx_core_ns_syn"
  echo "RX 2 lanes"
  endif
  else if ( == "rx" &&  == "4")
    setenv project_name       "mipi_4_tx_core_ns"
    setenv synth_logfile_name "mipi_4_tx_core_ns_syn"
    echo "RX 4 lanes"
endif
  else if ( == "plldig")
    setenv project_name       "dphyplldig"
    setenv synth_logfile_name "dphyplldig_syn"
  endif  
  else
    echo "No options specified"

endif

查看 if else 放置。在 ifs

之后你不见了
#!/bin/csh

if ( == "rx" &&  == "2") then
    setenv project_name       "mipi_2_rx_core_ns"
    setenv synth_logfile_name "mipi_2_rx_core_ns_syn"
    echo "RX 2 lanes"
else if ( == "rx" &&  == "4") then
    setenv project_name       "mipi_4_tx_core_ns"
    setenv synth_logfile_name "mipi_4_tx_core_ns_syn"
    echo "RX 4 lanes"
else if ( == "plldig") then
    setenv project_name       "dphyplldig"
    setenv synth_logfile_name "dphyplldig_syn"
else
    echo "No options specified"
endif