people.sortedByDescending { person -> people.count { it.firstName == person.firstName } }
所以我用C编写的程序称为test,我想在bash中运行它以便
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int kp_test_open(const char *name);
int kp_test_close(int fd);
int kp_test_open(const char *name){
int dskr;
dskr = open( name, O_RDONLY );
if( dskr == -1 ){
perror( name );
exit(1);
}
printf( "dskr = %d\n", dskr );
return dskr;
}
int kp_test_close(int fd){
int rv;
rv = close( fd );
if( rv != 0 ) perror ( "close() failed" );
else puts( "closed" );
return rv;
}
int main( int argc, char *argv[] ){
int d;
if( argc != 2 ){
printf( "Naudojimas:\n %s failas_ar_katalogas\n", argv[0] );
exit( 255 );
}
d = kp_test_open( argv[1] );
kp_test_close( d );
kp_test_close( d ); /* turi mesti close klaida */
return 0;
}
这3行将被激活,我必须以某种方式将argc值更改为2,我能以某种方式在bash中进行吗?
当我运行我编译的脚本时,我使用
d = kp_test_open( argv[1] );
kp_test_close( d );
kp_test_close( d );
现在我得到了这些结果
./test