- 
      
- 
        Save MiteshShah/ffaea2bcde07c29bf25ee4a283a6a604 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/bash | |
| echo "Enter Array: " | |
| read -a array | |
| echo "Total Element = ${#array[@]}" | |
| IFS=$'\n' sorted=($(sort -n <<<"${array[*]}")) | |
| echo | |
| echo Sorted Array = ${sorted[@]} | |
| for i in $(sort -un <<<"${array[*]}") | |
| do | |
| count=0; | |
| for j in ${sorted[@]} | |
| do | |
| # echo i = $i | |
| # echo j = $j | |
| if [[ $i -eq $j ]]; then | |
| count=$((count+1)) | |
| # echo count = $count | |
| fi | |
| done | |
| echo $count $i | |
| done | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment