Skip to main content
added 4 characters in body
Source Link
llua
  • 7.1k
  • 27
  • 31

Instead of

echo $input"$input"

try

eval echo $input"$input"

It's not even bash-specific, works on /bin/sh!

Note that this poses a serious security risk because eval just executes what you give it. In this case, the shell interprets the string $input as $test, and then eval executes echo $test. But what if the user entered $test; rm -rf *? eval would be presented with echo $test; rm -rf *. Be very careful if you do this.

Instead of

echo $input

try

eval echo $input

It's not even bash-specific, works on /bin/sh!

Note that this poses a serious security risk because eval just executes what you give it. In this case, the shell interprets the string $input as $test, and then eval executes echo $test. But what if the user entered $test; rm -rf *? eval would be presented with echo $test; rm -rf *. Be very careful if you do this.

Instead of

echo "$input"

try

eval echo "$input"

It's not even bash-specific, works on /bin/sh!

Note that this poses a serious security risk because eval just executes what you give it. In this case, the shell interprets the string $input as $test, and then eval executes echo $test. But what if the user entered $test; rm -rf *? eval would be presented with echo $test; rm -rf *. Be very careful if you do this.

insecure
Source Link
Moonchild
  • 199
  • 1
  • 7

Instead of

echo $input

try

eval echo $input

It's not even bash-specific, works on /bin/sh!

Note that this poses a serious security risk because eval just executes what you give it. In this case, the shell interprets the string $input as $test, and then eval executes echo $test. But what if the user entered $test; rm -rf *? eval would be presented with echo $test; rm -rf *. Be very careful if you do this.

Instead of

echo $input

try

eval echo $input

It's not even bash-specific, works on /bin/sh!

Instead of

echo $input

try

eval echo $input

It's not even bash-specific, works on /bin/sh!

Note that this poses a serious security risk because eval just executes what you give it. In this case, the shell interprets the string $input as $test, and then eval executes echo $test. But what if the user entered $test; rm -rf *? eval would be presented with echo $test; rm -rf *. Be very careful if you do this.

Source Link
Moonchild
  • 199
  • 1
  • 7

Instead of

echo $input

try

eval echo $input

It's not even bash-specific, works on /bin/sh!