小编Jos*_*eau的帖子

删除 Bash 中第一个空格右侧的字符

2492  some string continues here
Run Code Online (Sandbox Code Playgroud)

我想将其转换为

2492
Run Code Online (Sandbox Code Playgroud)

在巴什。我该怎么做?

这感觉很接近,但不起作用:

var="2492  some string continues here  "
echo ${var%[[:space:]]*}
Run Code Online (Sandbox Code Playgroud)

shell bash shell-script regular-expression

9
推荐指数
1
解决办法
6717
查看次数

标签 统计

bash ×1

regular-expression ×1

shell ×1

shell-script ×1