Skip to main content
Minor formatting
Source Link
AdminBee
  • 23.6k
  • 25
  • 55
  • 77

I have something like this in bash on Linux:

some_variable= ls *somepattern* | xargs cat | wc -c

And i would like to multiply that by some amount like:

another_variable = $(($some_variable * 10))

But i get an error

-bash: * 100: syntax error: operand expected (error token is "* 100")

  -bash: * 100: syntax error: operand expected (error token is "* 100")

Why is it not possible to not multiply some_variablesome_variable with wcwc?

I have something like this in bash on Linux:

some_variable= ls *somepattern* | xargs cat | wc -c

And i would like to multiply that by some amount like:

another_variable = $(($some_variable * 10))

But i get an error

-bash: * 100: syntax error: operand expected (error token is "* 100")

Why is it not possible to not multiply some_variable with wc?

I have something like this in bash on Linux:

some_variable= ls *somepattern* | xargs cat | wc -c

And i would like to multiply that by some amount like:

another_variable = $(($some_variable * 10))

But i get an error

  -bash: * 100: syntax error: operand expected (error token is "* 100")

Why is it not possible to not multiply some_variable with wc?

edited tags
Source Link
terdon
  • 252.3k
  • 69
  • 480
  • 718

I have something like this in bash on Linux:

some_variable= ls *somepattern* | xargs cat | wc -c

And i would like to multiply that by some amount like:

another_variable = $(($some_variable * 10))

But i get an error

-bash: * 100: syntax error: operand expected (error token is "* 100")

Why is it not possible to not multiply some_variable with wc?

I have something like this:

some_variable= ls *somepattern* | xargs cat | wc -c

And i would like to multiply that by some amount like:

another_variable = $(($some_variable * 10))

But i get an error

-bash: * 100: syntax error: operand expected (error token is "* 100")

Why is it not possible to not multiply some_variable with wc?

I have something like this in bash on Linux:

some_variable= ls *somepattern* | xargs cat | wc -c

And i would like to multiply that by some amount like:

another_variable = $(($some_variable * 10))

But i get an error

-bash: * 100: syntax error: operand expected (error token is "* 100")

Why is it not possible to not multiply some_variable with wc?

Source Link

Cannot multiply a variable with concatenated word count

I have something like this:

some_variable= ls *somepattern* | xargs cat | wc -c

And i would like to multiply that by some amount like:

another_variable = $(($some_variable * 10))

But i get an error

-bash: * 100: syntax error: operand expected (error token is "* 100")

Why is it not possible to not multiply some_variable with wc?