skip to main content

SAP NetWeaver Newbie

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

No comments:

Post a Comment

Email Subscription

Get every new post into your inbox by subscribing us.

Want a reason to subscribe?
1. This sitemap might convince you to subscribe.
2. We do not misuse email IDs. We respect privacy.

© 2008 - 2017 sapnwnewbie. All rights reserved.