如何使“ getfacl”结果以文件夹名和文件名的字母顺序排列?

时间:2019-02-02 02:41:11

标签: bash

我的系统是centos7。我想比较备份和现有文件夹的ACL。

我注意到一个问题:while(1) { fprintf( logfile, "Looped!\n"); } 的结果不是按字母顺序排列的,因此用户fprintf( logfile, "Called as %s\n", executable ); fprintf( logfile, "Assigned pid %lu\n", pid ); fprintf( logfile, "Input File: %s\n", inputfilename ); fprintf( logfile, "Output File: %s\n", outputfilename ); fprintf( logfile, "Default BUFFER: %lu\n", BUFFER ); fprintf( logfile, "Crypt output sixe: %lu\n", CRYPT_OUTPUT_SIZE ); fprintf( logfile, "\n" ); /* Try to set up space for strings */ fprintf( logfile, "Attempting to allocate %lu chars(%u) for plaintext string...\n", BUFFER,sizeof(char) ); char *plaintext_string = (char *) calloc( BUFFER, sizeof(char) ); if( plaintext_string == NULL ) { fprintf( logfile, "Errno %d; Error %s; Trying to allocate %lu chars(%u) for plaintext string\n", errno, strerror(errno), BUFFER,sizeof(char) ); return(STRERROR); } fprintf( logfile, "Success; Now attempting to allocate %lu bytes for encrypted string...\n", CRYPT_OUTPUT_SIZE ); char *encrypted_string = (char *) calloc( CRYPT_OUTPUT_SIZE, sizeof(char) ); if( encrypted_string == NULL ) { fprintf( logfile, "Errno %d; Error %s; Trying to allocate %lu chars(%u) for encrypted string\n", errno, strerror(errno), (unsigned long) CRYPT_OUTPUT_SIZE, sizeof(char) ); return(STRERROR); } fprintf( logfile, "\n" ); fprintf( logfile, "Entering main loop\n" ); while( TRUE ) { int res = fscanf( inputfile, "%s", plaintext_string ); if( res == EOF ) { fprintf( logfile, "Reached EOF in %s; Breaking from loop\n", inputfilename ); break; } if( plaintext_string == NULL ) { fprintf( logfile, "Errno %d; Error %s; String read in from %s was NULL\n", errno, strerror(errno), inputfilename); free(plaintext_string); free(encrypted_string); fclose(logfile); fclose(inputfile); return(STRERROR); } strcpy( encrypted_string, crypt( plaintext_string, SALT ) ); if( encrypted_string == NULL ) { fprintf( logfile, "Errno %d; Error %s; Encrypted string was NULL\n", errno, strerror(errno) ); free(plaintext_string); free(encrypted_string); fclose(logfile); fclose(inputfile); return(STRERROR); } fprintf( outputfile, "%s\n", encrypted_string ); /* Clear the strings so no data is held */ *plaintext_string = NULL; *encrypted_string = NULL; } 很难进行比较。

理想的字母顺序为:按文件夹名称字母顺序的文件夹列表。文件夹列表中的文件按文件名字母顺序排列。如下:

getfacl

如何使beyond compare结果以文件夹名和文件名的字母顺序排列?

0 个答案:

没有答案