Accessing array elements with spaces in TCSH

后端 未结 1 1632
长情又很酷
长情又很酷 2021-01-29 02:57

I\'m trying to create a small little convenience script for our team. Unfortunately, our entire build environment is based on tcsh for historical reasons. In the

相关标签:
1条回答
  • 2021-01-29 03:38

    Using the linked duplicate, I was able to find a complete answer:

    foreach pair ( $BUILD_MATRIX:q )
      set candidate = `echo $pair | sed 's/\([^:]*\):\(.*\)/\1/'`
      set command   = `echo $pair | sed 's/\([^:]*\):\(.*\)/\2/'`
      echo "pair: ${pair}"
      echo "candidate: ${candidate}"
      echo "command: ${command}"
    end
    
    0 讨论(0)
提交回复
热议问题