What is: for i in `ls ${ILPM_APPLICATION_LOG_DIR}/${PREFIX}*`
APPLICATION_LOG_DIR=/home/users/sosst51/test-chinboon/logs/testdata1
PREFIX=mylog
for i in `ls ${APPLICATION_LOG_DIR}/开发者_开发知识库${PREFIX}*`
Is this a for loop whereby i am passing the ls of the directory into i.
In bash, for s in string will take a string and split it on whitespace, and iterate over each of the words. So:
for s in a b c; do echo $s; done
would print:
a
b
c
By passing it the output of ls, you're iterating over all of the files in that directory (careful though, it's going to break if any of the filenames contain spaces). This one in particular is iterating over files that start with "mylog".
Yes, it is a for loop. Yes, the output of the ls command is used to provide the list of values that $i takes.
The output of the ls command is split into separate words at the white space (such as newlines, or blanks or tabs). This means that if any filenames contain white space, the names will be split into two (or more) components.
加载中,请稍侯......
精彩评论