Home > OS >  How the Linux shell all file names in the directory, and saved to the variable
How the Linux shell all file names in the directory, and saved to the variable

Time:03-14

Hello:
/bacK_ver temp_test $ls -l
DRWXRWXR - x 2 ailiving ailiving on March 12, 4096 gathered zhilian_user_202103121727
DRWXRWXR - x 2 ailiving ailiving on March 12, 4096 19:09 zhilian_user_202103121820
There are two catalogue, how do I get the names of the two directories, and saved to variables,
Preferably with C language, have an array, and then I can
Compare these two directory name size

The great spirit guide, please

CodePudding user response:

The test $ls -l
Zhilian_user_202103121727
Zhilian_user_202103121820

The test $LS_DIR_NAME=` ls lt/bacK_ver temp_test/| grep zhilian_user | head - n 1 | awk '} {print $9 `
The test $echo $LS_DIR_NAME
Zhilian_user_202103121820
  • Related