loop through files in a directory in shell script
Given a directory and loops through all the visible files.
[code language=”shell”]
#!/bin/sh
DIR=’/var/log/myapp/’
for FILE in ls "$DIR"*
do
echo $FILE
done
[/code]
Loops files in the given directory and prints files with extension .log
[code language=”shell”]
#!/bin/sh
DIR=’/var/log/myapp/’
for FILE in ls "$DIR"*.log
do
echo $FILE
done
[/code]
Search within Codexpedia

Custom Search
Search the entire web

Custom Search
Related Posts