4 Rollback to Revision 2
source | link
for i in Alpha Beta Charlie; do
  echo "$i"
done

You don't need eval and you don't need ls.

Alternatively, you could just print each of these directly, with a newline character after each:

printf '%s\n' Alpha Beta Charlie

Please don't use eval unless you absolutely must. (Hint: Unless you get seriously complicated, you never need it.) Using eval when you don't have to just leads to security holes.


Your initial question is very clear:

Write a loop to go through three values (A B C) and displays each of these values to the screen (hint use a ‘for’ loop).

However from your comment perhaps you want to execute some commands in a loop:

I want the value T exp 1 exp2 exp3 to execute

If you want to execute commands in a loop, just write the commands and put them in a loop:

for i in {1..3}; do
  echo Hip Hip
  echo 'HOORAY!'
done

The first line of this could just as easily be for i in A B C; do and it would do the same thing. We You don't use the variable $i anywhere in thisyour loop, but you don't have to. It will still execute three times.

for i in Alpha Beta Charlie; do
  echo "$i"
done

Alternatively, you could just print each of these directly, with a newline character after each:

printf '%s\n' Alpha Beta Charlie

Your initial question is very clear:

Write a loop to go through three values (A B C) and displays each of these values to the screen (hint use a ‘for’ loop).

However from your comment perhaps you want to execute some commands in a loop:

I want the value T exp 1 exp2 exp3 to execute

If you want to execute commands in a loop, just write the commands and put them in a loop:

for i in {1..3}; do
  echo Hip Hip
  echo 'HOORAY!'
done

The first line of this could just as easily be for i in A B C; do and it would do the same thing. We don't use the variable $i anywhere in this loop, but you don't have to. It will still execute three times.

for i in Alpha Beta Charlie; do
  echo "$i"
done

You don't need eval and you don't need ls.

Alternatively, you could just print each of these directly, with a newline character after each:

printf '%s\n' Alpha Beta Charlie

Please don't use eval unless you absolutely must. (Hint: Unless you get seriously complicated, you never need it.) Using eval when you don't have to just leads to security holes.


Your initial question is very clear:

Write a loop to go through three values (A B C) and displays each of these values to the screen (hint use a ‘for’ loop).

However from your comment perhaps you want to execute some commands in a loop:

I want the value T exp 1 exp2 exp3 to execute

If you want to execute commands in a loop, just write the commands and put them in a loop:

for i in {1..3}; do
  echo Hip Hip
  echo 'HOORAY!'
done

The first line of this could just as easily be for i in A B C; do and it would do the same thing. You don't use the variable $i anywhere in your loop, but you don't have to. It will still execute three times.

3 Now the other answer is deleted, removing mention of eval
source | link
for i in Alpha Beta Charlie; do
  echo "$i"
done

You don't need eval and you don't need ls.

Alternatively, you could just print each of these directly, with a newline character after each:

printf '%s\n' Alpha Beta Charlie

Please don't use eval unless you absolutely must. (Hint: Unless you get seriously complicated, you never need it.) Using eval when you don't have to just leads to security holes.


Your initial question is very clear:

Write a loop to go through three values (A B C) and displays each of these values to the screen (hint use a ‘for’ loop).

However from your comment perhaps you want to execute some commands in a loop:

I want the value T exp 1 exp2 exp3 to execute

If you want to execute commands in a loop, just write the commands and put them in a loop:

for i in {1..3}; do
  echo Hip Hip
  echo 'HOORAY!'
done

The first line of this could just as easily be for i in A B C; do and it would do the same thing. You We don't use the variable $i anywhere in yourthis loop, but you don't have to. It will still execute three times.

for i in Alpha Beta Charlie; do
  echo "$i"
done

You don't need eval and you don't need ls.

Alternatively, you could just print each of these directly, with a newline character after each:

printf '%s\n' Alpha Beta Charlie

Please don't use eval unless you absolutely must. (Hint: Unless you get seriously complicated, you never need it.) Using eval when you don't have to just leads to security holes.


Your initial question is very clear:

Write a loop to go through three values (A B C) and displays each of these values to the screen (hint use a ‘for’ loop).

However from your comment perhaps you want to execute some commands in a loop:

I want the value T exp 1 exp2 exp3 to execute

If you want to execute commands in a loop, just write the commands and put them in a loop:

for i in {1..3}; do
  echo Hip Hip
  echo 'HOORAY!'
done

The first line of this could just as easily be for i in A B C; do and it would do the same thing. You don't use the variable $i anywhere in your loop, but you don't have to. It will still execute three times.

for i in Alpha Beta Charlie; do
  echo "$i"
done

Alternatively, you could just print each of these directly, with a newline character after each:

printf '%s\n' Alpha Beta Charlie

Your initial question is very clear:

Write a loop to go through three values (A B C) and displays each of these values to the screen (hint use a ‘for’ loop).

However from your comment perhaps you want to execute some commands in a loop:

I want the value T exp 1 exp2 exp3 to execute

If you want to execute commands in a loop, just write the commands and put them in a loop:

for i in {1..3}; do
  echo Hip Hip
  echo 'HOORAY!'
done

The first line of this could just as easily be for i in A B C; do and it would do the same thing. We don't use the variable $i anywhere in this loop, but you don't have to. It will still execute three times.

2 There, cutzerolongduezboodacrovinungh, happy now?
source | link
for i in Alpha Beta Charlie; do
  echo "$i"
done

You don't need eval and you don't need ls.

Alternatively, you could just print each of these directly, with a newline character after each:

printf '%s\n' Alpha Beta Charlie

Please don't use eval unless you absolutely must. (Hint: Unless you get seriously complicated, you never need it.) Using eval when you don't have to just leads to security holes.


Your initial question is very clear:

Write a loop to go through three values (A B C) and displays each of these values to the screen (hint use a ‘for’ loop).

However from your comment perhaps you want to execute some commands in a loop:

I want the value T exp 1 exp2 exp3 to execute

If you want to execute commands in a loop, just write the commands and put them in a loop:

for i in {1..3}; do
  echo Hip Hip
  echo 'HOORAY!'
done

The first line of this could just as easily be for i in A B C; do and it would do the same thing. You don't use the variable $i anywhere in your loop, but you don't have to. It will still execute three times.

for i in Alpha Beta Charlie; do
  echo "$i"
done

You don't need eval and you don't need ls.

Alternatively, you could just print each of these directly, with a newline character after each:

printf '%s\n' Alpha Beta Charlie

Please don't use eval unless you absolutely must. (Hint: Unless you get seriously complicated, you never need it.) Using eval when you don't have to just leads to security holes.

for i in Alpha Beta Charlie; do
  echo "$i"
done

You don't need eval and you don't need ls.

Alternatively, you could just print each of these directly, with a newline character after each:

printf '%s\n' Alpha Beta Charlie

Please don't use eval unless you absolutely must. (Hint: Unless you get seriously complicated, you never need it.) Using eval when you don't have to just leads to security holes.


Your initial question is very clear:

Write a loop to go through three values (A B C) and displays each of these values to the screen (hint use a ‘for’ loop).

However from your comment perhaps you want to execute some commands in a loop:

I want the value T exp 1 exp2 exp3 to execute

If you want to execute commands in a loop, just write the commands and put them in a loop:

for i in {1..3}; do
  echo Hip Hip
  echo 'HOORAY!'
done

The first line of this could just as easily be for i in A B C; do and it would do the same thing. You don't use the variable $i anywhere in your loop, but you don't have to. It will still execute three times.

1
source | link