Skip to content
Advertisement

How to use variables in shell?

Having a simple script like this, which should convert minutes to seconds

JavaScript

When run after entering a number (5), it outputs an expression "expr $x '*' 60" instead of a product(300). What could be the reason?

Advertisement

Answer

You didn’t execute the expression, instead you created a string. Try it like this:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement