在bash中,如何将N个参数连接在一起作为空格分隔的字符串空格、字符串、如何将、参数

2023-09-06 18:37:48 作者:我给不了你的谁还能给*

I'm trying to write a function that takes n parameters and joins them into a string.

In Perl it would be

my $string = join(' ', @ARGV);
字符中不能包括空格的正则表达式怎样写

but in bash I don't know how to do it

function()
{
    ??
}

解决方案

Check the bash man page for the entry for '*' under Special Parameters.

join () {
    echo "$*"
}

 
精彩推荐