Skip to main content
deleted 37 characters in body
Source Link
glenn jackman
  • 88.5k
  • 16
  • 124
  • 179

Use "$@" instead of ${*} (see Special Parameters in the manual)

for f in "$@"; do 
    echo make sure you quote your "$variables" everywhere in the loop

    # ...

There's a shorthand (and more portable) for this:

for f do ...

for f; do would also work in some shells but is not standard.

Use "$@" instead of ${*} (see Special Parameters in the manual)

for f in "$@"; do 
    echo make sure you quote your "$variables" everywhere in the loop

    # ...

There's a shorthand (and more portable) for this:

for f do ...

for f; do would also work in some shells but is not standard.

Use "$@" instead of ${*} (see Special Parameters in the manual)

for f in "$@"; do 
    echo make sure you quote your "$variables" everywhere in the loop

There's a shorthand (and more portable) for this:

for f do ...

for f; do would also work in some shells but is not standard.

added 91 characters in body
Source Link
Stéphane Chazelas
  • 584.9k
  • 96
  • 1.1k
  • 1.7k

Use "$@" instead of ${*} (see Special Parameters in the manual)

for f in "$@"; do 
    echo make sure you quote your "$variables" everywhere in the loop

    # ...

There's a shorthand (and more portable) for this:

for f;f do ...

for f; do would also work in some shells but is not standard.

Use "$@" instead of ${*} (see Special Parameters in the manual)

for f in "$@"; do 
    echo make sure you quote your "$variables" everywhere in the loop

    # ...

There's a shorthand for this:

for f; do ...

Use "$@" instead of ${*} (see Special Parameters in the manual)

for f in "$@"; do 
    echo make sure you quote your "$variables" everywhere in the loop

    # ...

There's a shorthand (and more portable) for this:

for f do ...

for f; do would also work in some shells but is not standard.

Source Link
glenn jackman
  • 88.5k
  • 16
  • 124
  • 179

Use "$@" instead of ${*} (see Special Parameters in the manual)

for f in "$@"; do 
    echo make sure you quote your "$variables" everywhere in the loop

    # ...

There's a shorthand for this:

for f; do ...