article author: Tyan
blog: noahsnail.com | CSDN | short book
sometimes need to get all the file names under a folder, can be implemented with the program, but open the IDE, compile and run too troublesome, in Linux server usually can not open the IDE, at this time can be implemented with a few lines of simple shell command, the result can be saved in a file.
Shell script is as follows:
#!/bin/bash
# get all filename in specified path
path=$1
files=$(ls $path)
for filename in $files
do
echo $filename >> filename.txt
done
div>
Read More:
- Method of modifying file and folder permission by Chmod command in Linux
- Delete files with specified suffix in specified folder under Linux
- Linux view folder size, remaining disk space (DU / DF)
- Linux shell RM deletes all. O suffix files in the subdirectory
- The out folder does not appear under the idea project. Set the entire compilation information to the target folder
- Error:No toolchains found in the NDK toolchains folder for ABI with prefix: mipsel-linux-android
- Linux use ls to view the file color is all white solution, and Linux file color introduction
- Removing duplicate lines from Linux shell files
- Several methods of executing multiple commands in Linux shell
- Bash modifies the file names in the specified folder through MAC terminal (batch modification)
- Linux shell loop in a line for while
- Common shell (1): shell gets the current time stamp of the system
- Solution to the error $’\ R’: command not found when executing shell script under Linux
- In Linux shell script, about the commonly used flag [- EQ, GT..] in test and if judgment
- Linux’s method of clearing DNS cache and refreshing DNS in shell terminal (Ubuntu, Debian)
- The Linux terminal appears bash: setup.bash : no such file or directory, and. Bashrc file
- Alpine Linux executable file crash report error / lib / x86 not found_ 64 Linux GNU / libc.so solution
- An undetermined call to function ‘shell’: missing ‘. Stop. Problem encountered when using shell command in makefile
- Failed to import static file of vue3 static resource. There is no static folder
- How to Fix Unknown error: Unable to build: the file dx.jar was not loaded from the SDK folder!