You are viewing a single comment's thread. Return to all comments →
You may try this too,
Works even for the test case:
5
1 2 2 2 1
Output: 2
read arr=($(cat)) arr=${arr[*]} echo $((${arr// /^}))
Seems like cookies are disabled on this browser, please enable them to open this website
Lonely Integer - Bash!
You are viewing a single comment's thread. Return to all comments →
You may try this too,
Works even for the test case:
5
1 2 2 2 1
Output: 2