Vote count:
0
I am attempting to learn bash, and I tried making a simple bash script to test my terminal. However, when using the expr command, the system keeps telling me that the syntax for the expr command is wrong. Here is the script:
#!/bin/bash
declare -a typo
x=0
y=25
function arrayAndDisplay {
for x in y;
do
typo[x]= `expr $x * 25`
echo ${typo[x]}
done
}
arrayAndDisplay
When I try running the script in the terminal, this is the error message I get:
expr: syntax error
I've looked at reference websites and other StackOverflow posts, but nothing seems to work. Can anyone help me?
P.S: I use Mac OS X Yosemite (10.10.1)
asked 49 secs ago
bash expr syntax error when multiplying variable by integer
Aucun commentaire:
Enregistrer un commentaire