Reputation: 23
Having a simple script like this, which should convert minutes to seconds
#!bin/bash
echo 'input_minutes'
read x
time="expr $x '*' 60"
echo $time
When run after entering a number (5), it outputs an expression "expr $x '*' 60"
instead of a product(300). What could be the reason?
Upvotes: 0
Views: 25
Reputation: 676
You didn't execute the expression, instead you created a string. Try it like this:
time=$(expr $x '*' 60)
Upvotes: 1