number of tokens in bash variable

前端 未结 7 2156
挽巷
挽巷 2020-12-09 08:41

how can I know the number of tokens in a bash variable (whitespace-separated tokens) - or at least, wether it is one or there are more.

相关标签:
7条回答
  • 2020-12-09 09:05

    Not sure if this is exactly what you meant but:

    $# = Number of arguments passed to the bash script

    Otherwise you might be looking for something like man wc

    0 讨论(0)
提交回复
热议问题