How to Make an If-Else in Csh Script
I'm Trying to Make an If-Else in Csh Script but It Is Not Working: Do You Know Why This Is Not Working? If($2 == "Rx" && $3 == "2") Then Setenv Project_Name...
I'm trying to make an if-else in csh script but it is not working:
do you know why this is not working?
if($2 == "rx" && $3 == "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 ($2 == "rx" && $3 == "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 ($2 == "plldig")
setenv project_name "dphyplldig"
setenv synth_logfile_name "dphyplldig_syn"
endif
else
echo "No options specified"
endif
1 Answer
See the if else placement. You are missing then after ifs
#!/bin/csh
if ($2 == "rx" && $3 == "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 ($2 == "rx" && $3 == "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 ($2 == "plldig") then
setenv project_name "dphyplldig"
setenv synth_logfile_name "dphyplldig_syn"
else
echo "No options specified"
endif