[英]how do I check curdepth in bash script?
我想将CURDEPTH另存为bash脚本中的变量吗? 有没有一种方法可以运行此操作并将当前的深度量保存为变量?
runmqsc QMGR
dis ql (##############) where(curdepth gt 1)
3 : dis ql (##############) where(curdepth gt 1)
AMQ8409: Display Queue details.
QUEUE(#############) TYPE(QLOCAL)
CURDEPTH(71514)
end
代替
grep 'CURDEPTH(' | sed 's/.*CURDEPTH//' | tr -d '()'
如果您有GNU grep,则可以执行此操作
grep -oP '(?<=CURDEPTH\()\d+'
否则,使用一个sed命令
sed -n '/[[:blank:]]*CURDEPTH(\([[:digit:]]\+\))/s//\1/p'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.