Loops in UNIX Shell Scripts - for Statement

The for statement lets iterations through a list of values.

Syntax:

for variable in list_of_values; do
commands
done

Example:

The example script lists files and directories (with their content) starting with the letter a, b and c.

#!/bin/sh

for i in a b c; do
ls  ${i}*
done

exit 0

Comments

Popular posts from this blog

OS/DB Migration - CMD. STR, TOC, EXT, R3load, DDLDBS.TPL and more

Fixing Inconsistent Table - Table activation fails due to inconsistency between DD and DB

301 Redirect Using SAP Web Dispatcher