Skip to main content
deleted 70 characters in body
Source Link
Siva
  • 9.3k
  • 9
  • 60
  • 88

As per your expected output,

  • Remove the not operator ! while calling the array in for loop.
  • we don't require "Processing file" in that echo command.
  • we don't need to pass the index value of array while looping it in for loop.

Try as

declare -a files=( "A1S0" "D1S0" "D2S0" "D3S0" "D4S0" "D5S0" "D6S0" )
command_to_get_filesizes() 
{
  for i in "${files[@]}"; do
    echo "$i"
  done
}
command_to_get_filesizes

As per your expected output,

  • Remove the not operator ! while calling the array in for loop.
  • we don't require "Processing file" in that echo command.
  • we don't need to pass the index value of array while looping it in for loop.

Try as

declare -a files=( "A1S0" "D1S0" "D2S0" "D3S0" "D4S0" "D5S0" "D6S0" )
command_to_get_filesizes() 
{
  for i in "${files[@]}"; do
    echo "$i"
  done
}
command_to_get_filesizes

As per your expected output,

  • we don't require "Processing file" in that echo command.
  • we don't need to pass the index value of array while looping it in for loop.

Try as

declare -a files=( "A1S0" "D1S0" "D2S0" "D3S0" "D4S0" "D5S0" "D6S0" )
command_to_get_filesizes() 
{
  for i in "${files[@]}"; do
    echo "$i"
  done
}
command_to_get_filesizes
Source Link
Siva
  • 9.3k
  • 9
  • 60
  • 88

As per your expected output,

  • Remove the not operator ! while calling the array in for loop.
  • we don't require "Processing file" in that echo command.
  • we don't need to pass the index value of array while looping it in for loop.

Try as

declare -a files=( "A1S0" "D1S0" "D2S0" "D3S0" "D4S0" "D5S0" "D6S0" )
command_to_get_filesizes() 
{
  for i in "${files[@]}"; do
    echo "$i"
  done
}
command_to_get_filesizes