Home > OS >  Shell regular expression question, who is a great god to see how to solve
Shell regular expression question, who is a great god to see how to solve

Time:04-22

Because the company use genesis2000, PCB industry with CSH

Now my question is

#! C:/usr/bin/CSH
Set a=+ 2.4
The set b=2.4

The set a1=` echo "$a" | the cut - c1 `


PAUSE $a1 # # # # # # # # # # # # # get is +

PAUSE $c
If ($a1=="+") then
PAUSE "true"
The else
PAUSE "false"
Endif

Why # # # # # # # # # $a1 with "+" is not equal to other variables such as the set c="+" equal or not? With what to write regular expressions (matching the first symbol is + or -, I use a regular expression or wrong)
If [$a=~ ^ +] then always returns true, who knows how to write the grammar, check a lot of information, there is no regular chsell, variable a is the first character is a + or -
PAUSE "true"
The else
PAUSE "false"
Endif

Thank you, glad to
  • Related