Skip to main content
format update
Source Link
Stephen Rauch
  • 4.3k
  • 15
  • 24
  • 33

I want a script to calculate the sum of the numbers entered by the user.

so far I have:

#!/bin/bash
add() {
  sum=0

  for num
  do
          sum=$((sum +num))
  done

  }

  echo "$sum"

the command I use is: add 4 -3 9 12 the

add 4 -3 9 12

the return is: blank line - not the words just a blank line username~/folder:>

what am I missing?

permissions are rwxr xr x I'm running an interactive shell with the folder in my path, I'm at a loss.

I want a script to calculate the sum of the numbers entered by the user.

so far I have:

#!/bin/bash
add() {
  sum=0

  for num
  do
          sum=$((sum +num))
  done

  }

  echo "$sum"

the command I use is: add 4 -3 9 12 the return is: blank line - not the words just a blank line username~/folder:>

what am I missing?

permissions are rwxr xr x I'm running an interactive shell with the folder in my path, I'm at a loss.

I want a script to calculate the sum of the numbers entered by the user.

so far I have:

#!/bin/bash
add() {
  sum=0

  for num
  do
          sum=$((sum +num))
  done

}

echo "$sum"

the command I use is:

add 4 -3 9 12

the return is: blank line - not the words just a blank line username~/folder:>

what am I missing?

permissions are rwxr xr x I'm running an interactive shell with the folder in my path, I'm at a loss.

I want a script to calculate the sum of the numbers entered by the user.

so far I have:

#!/bin/bash
add() {
  sum=0

  for num
  do
          sum=$((sum +num))
  done

  }

  echo "$sum"
#!/bin/bash
add() {
  sum=0

  for num
  do
          sum=$((sum +num))
  done

  }

  echo "$sum"

the command I use is: add 4 -3 9 12 the return is: blank line - not the words just a blank line username~/folder:>

what am I missing?

permissions are rwxr xr xrwxr xr x I'm running an interactive shell with the folder in my path, I'm at a loss.

I want a script to calculate the sum of the numbers entered by the user.

so far I have:

#!/bin/bash
add() {
  sum=0

  for num
  do
          sum=$((sum +num))
  done

  }

  echo "$sum"

the command I use is: add 4 -3 9 12 the return is: blank line - not the words just a blank line username~/folder:>

what am I missing?

permissions are rwxr xr x I'm running an interactive shell with the folder in my path, I'm at a loss.

I want a script to calculate the sum of the numbers entered by the user.

so far I have:

#!/bin/bash
add() {
  sum=0

  for num
  do
          sum=$((sum +num))
  done

  }

  echo "$sum"

the command I use is: add 4 -3 9 12 the return is: blank line - not the words just a blank line username~/folder:>

what am I missing?

permissions are rwxr xr x I'm running an interactive shell with the folder in my path, I'm at a loss.

Format code as code.
Source Link
John1024
  • 76.4k
  • 12
  • 176
  • 165

I want a script to calculate the sum of the numbers entered by the user.

so far I have:

#!/bin/bash add() { sum=0

for num do sum=$((sum +num)) done

}

echo "$sum"

#!/bin/bash
add() {
  sum=0

  for num
  do
          sum=$((sum +num))
  done

  }

  echo "$sum"

the command I use is: add 4 -3 9 12 the return is: blank line - not the words just a blank line username~/folder:>

what am I missing?

permissions are rwxr xr x I'm running an interactive shell with the folder in my path, I'm at a loss.

I want a script to calculate the sum of the numbers entered by the user.

so far I have:

#!/bin/bash add() { sum=0

for num do sum=$((sum +num)) done

}

echo "$sum"

the command I use is: add 4 -3 9 12 the return is: blank line - not the words just a blank line username~/folder:>

what am I missing?

permissions are rwxr xr x I'm running an interactive shell with the folder in my path, I'm at a loss.

I want a script to calculate the sum of the numbers entered by the user.

so far I have:

#!/bin/bash
add() {
  sum=0

  for num
  do
          sum=$((sum +num))
  done

  }

  echo "$sum"

the command I use is: add 4 -3 9 12 the return is: blank line - not the words just a blank line username~/folder:>

what am I missing?

permissions are rwxr xr x I'm running an interactive shell with the folder in my path, I'm at a loss.

Source Link
Loading