0

This piece of code:

foreach mod ("`lsmod`")
   echo $mod
end

outputs each line of lsmod. How can I access the first field, i.e. Module, from each line?

Is there any IDE forcsh or extension for vs code where I can debug csh code?

1 Answers1

2
foreach mod ("`lsmod`")
   set ml = ($mod)
   echo "$ml[1]"
end
  • Parentheses splits line with any type of delimiter or only space? –  Jul 13 '19 at 16:53
  • 2
    An unquoted variable will be split on any kind of whitespace (spaces, tabs, newlines), but multiple newlines will not be collapsed into a single separator. –  Jul 13 '19 at 17:04
  • I've another question on accessing fields –  Jul 16 '19 at 20:22