for f in file1 file2 file3 file5 do echo "Processing $f" # do something on $f done # USING SHELL VARIABLES FILES="file1 /path/to/file2 /etc/resolv.conf" for f in $FILES do echo "Processing $f" done # USING LOCAL FILES for f in *.txt; do echo "Processing $f file.."; done # OR shopt -s nullglob for f in *.pdf do echo "Removing password for pdf file - $f" done # ALL FILES IN A SPECIFIC PATH FILES=/path/to/* for f in $FILES do echo "Processing $f file..." # take action on each file. $f store current file name cat $f done
Be the first to commentYou can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.