I have written this code to find cube of the number which I am passing while executing this script like: ./my_script.sh 6
The code is working fine till 6 but after 6 it start producing unexpected results. For 7 it should give me cubeof(7) which is 343 but this code gives me 87 for that.
cube () {
return `expr "$1" \* "$1" \* "$1" `;
}
cube $1;
echo $?;
Some more test cases:
For 8 expected answer should be 512 but it gives 0 same as 9 it gives 217 as results