【发布时间】:2017-08-31 00:58:56
【问题描述】:
我有一个只有几行的变量。我想从变量的内容中删除最后一行。我搜索了互联网,但所有链接都在谈论从文件中删除最后一行。 这是我的变量的内容
$echo $var
$select key from table_test
UNION ALL
select fob from table_test
UNION ALL
select cal from table_test
UNION ALL
select rot from table_test
UNION ALL
$
我想去掉仅出现在最后一行的 UNION ALL。
【问题讨论】:
-
echo $var不会产生您显示的输出,尽管echo "$var"会。
标签: bash text-processing