首页 > 通过bash,输入含有()左右括号的字符串

通过bash,输入含有()左右括号的字符串

#include<stdio.h>
#include<string.h>

int main( int argc, char* argv[] )
{
    puts( argv[1] );
    return 0;
}

输入样例:()www
bash: 未预期的符号 `www' 附近有语法错误


可以将包含特殊字符的参数用单引号引起来,或者通过反斜杠转意:

[root@web ~]# ls ()
-bash: syntax error near unexpected token `('
[root@web ~]# ls '()'
ls: cannot access (): No such file or directory
[root@web ~]# ls \(\)
ls: cannot access (): No such file or directory
【热门文章】
【热门文章】