Hi ,
I have script as follows ,
#!/usr/bin/ksh -x
if [ `uname` = "Linux" ]
then
alias echo="echo -e"
fi
MAX_ENTRIES=1024
nb_of_entries=`echo "$list_of_entries" | wc -w`
# Set number of tables
eval nb_of_tables=\`expr `expr $nb_of_entries / $MAX_ENTRIES` + 1 \`
# Output the number of tables
echo $nb_of_tables
Here "list of entries" is list of PID's and we get the output as number of pids .
For this above part i get the following error ,
+ echo -e $' 1\n 2\n 3\n 4\n 5\n 6\n 7\n 8\n 9\n 10\n 11\n 12\n 13\n 14\n 15\n 16\n 17\n 18\n 59\n 66\n 67\n 68\n 69\n 70\n 233\n 234\n 235\n 236\n 239\n 241\n 328\n 329\n 330\n 331\n 332\n 333\n 334\n 544\n 596\n 597\n 598\n 599\n 600\n 626\n 629\n 657\n 691\n 1414\n 4674\n 4676\n 4677\n 4678\n 4718\n 4720\n 5060\n 5062\n 5094\n 5096\n 5119\n 5122\n 5134\n 5155\n 5184\n 5223\n 5242\n 5253\n 5257\n 5291\n 5329\n 5348\n 5366\n 5385\n 5396\n 5401\n 5416\n 5427\n 5439\n 5450\n 5461\n 5492\n 5513\n 5549\n 5550\n 5562\n 5564\n 5572\n 5577\n 5588\n 5660\n 5707\n 5770\n 5775\n 5776\n 5777\n 5779\n 5781\n 5783\n 5785\n 5883\n 5885\n 5886\n 5901\n 5904\n 5914\n 6046\n 6314\n 6316\n 6320\n 6332\n 6334\n 6336\n 6339\n 6347\n 6349\n 6351\n 6353\n 6362\n 6367\n 6399\n 6402\n 6404\n 6406\n 6408\n 6410\n 6412\n 6414\n 6416\n 6418\n 6420\n 6428\n 6431\n 6557\n 6568\n 6847\n 6850\n 6856\n 7354\n 7378\n 7405\n 7426\n 7448\n 7463\n 7472\n 7483\n 7541\n 7683\n 8119\n 8121\n 8323\n 8325\n 8326\n 8327\n15699\n21205\n21236\n25117'
+ wc -w
+ nb_of_entries=' 156'
+ expr 1 6 / 1024
expr: syntax error
Here 156 is replced with 1 6 which leads to syntax error . Please help me in finding what is making this corruption of variable value ?