问题在bash返回变量 [英] Problem with return variable in bash

查看:97
本文介绍了问题在bash返回变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这mysql命令行回我: COUNT(*)19 。这是一个大问题,因为我只是想 19 ,以使这个数字循环。我该怎么办?

  VAR = $(回声从shop_tab SELECT COUNT(*)所在目录下&;>'';| mysql的-h abcdcef.com --port = 3306 --user =根--password = hbbfe店)


解决方案

通过管道来切断头的结果:

  ...店|尾-1)

This mysql command line return me: count(*) 19. It's a big problem for me because I just want 19 to make a loop with this number. How can I do?

var = $(echo "select count(*) from shop_tab where catalog <> '';" | mysql -h abcdcef.com --port=3306 --user=root --password=hbbfe shop)

解决方案

Pipe the result through tail to cut off the header:

... shop | tail -1)

这篇关于问题在bash返回变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆