3 added 12 characters in body
source | link

You can add another associative array to keep track the order of declaration:

YELLOW=$'\e[93m'                                                                
declare -A OP=( [Description]="remote to destination"                           
                [Source]="/var/www"                                             
                [Destination]="/foo/bar"                                        
                [Log]="my.log"                                                  
                [Email]="me@here" )                                             

declare -A IP=( [1]="Description"                                               
                [2]="Source"                                                    
                [3]="Destination"                                               
                [4]="Log"                                                       
                [5]="Email" );                                                  

NO_COLS=$NO_COLS="$(tput cols)                                                            "
COLS_PER_COL=$COLS_PER_COL="$((NO_COLS/3))                                                     "
PRINT_FORMAT="%"$COLS_PER_COL"s%""s\n"                                          PRINT_FORMAT="%${COLS_PER_COL}s%s\n"

for i in "${!IP[@]}"; do                                                        
  k=${IP[$i]}                                                                   
  printf "$PRINT_FORMAT" "$k :" " $YELLOW${OP[$k]}$ENDCOL"                      
done

You can add another array to keep track the order of declaration:

YELLOW=$'\e[93m'                                                                
declare -A OP=( [Description]="remote to destination"                           
                [Source]="/var/www"                                             
                [Destination]="/foo/bar"                                        
                [Log]="my.log"                                                  
                [Email]="me@here" )                                             

declare -A IP=( [1]="Description"                                               
                [2]="Source"                                                    
                [3]="Destination"                                               
                [4]="Log"                                                       
                [5]="Email" );                                                  

NO_COLS=$(tput cols)                                                            
COLS_PER_COL=$((NO_COLS/3))                                                     
PRINT_FORMAT="%"$COLS_PER_COL"s%""s\n"                                          

for i in "${!IP[@]}"; do                                                        
  k=${IP[$i]}                                                                   
  printf "$PRINT_FORMAT" "$k :" " $YELLOW${OP[$k]}$ENDCOL"                      
done

You can add another associative array to keep track the order of declaration:

YELLOW=$'\e[93m'
declare -A OP=( [Description]="remote to destination"
                [Source]="/var/www"
                [Destination]="/foo/bar"
                [Log]="my.log"
                [Email]="me@here" )

declare -A IP=( [1]="Description"
                [2]="Source"
                [3]="Destination"
                [4]="Log"
                [5]="Email" );

NO_COLS="$(tput cols)"
COLS_PER_COL="$((NO_COLS/3))"
PRINT_FORMAT="%${COLS_PER_COL}s%s\n"

for i in "${!IP[@]}"; do
  k=${IP[$i]}
  printf "$PRINT_FORMAT" "$k :" " $YELLOW${OP[$k]}$ENDCOL"
done
2 added 112 characters in body
source | link

Associative array in bash (and in other languages) does not preserve the order of elements in declaration.

You can add another array to keep track the order of declaration:

You can add another array to keep track the order of declaration:

Associative array in bash (and in other languages) does not preserve the order of elements in declaration.

You can add another array to keep track the order of declaration:

1
source | link

You can add another array to keep track the order of declaration:

YELLOW=$'\e[93m'                                                                
declare -A OP=( [Description]="remote to destination"                           
                [Source]="/var/www"                                             
                [Destination]="/foo/bar"                                        
                [Log]="my.log"                                                  
                [Email]="me@here" )                                             

declare -A IP=( [1]="Description"                                               
                [2]="Source"                                                    
                [3]="Destination"                                               
                [4]="Log"                                                       
                [5]="Email" );                                                  

NO_COLS=$(tput cols)                                                            
COLS_PER_COL=$((NO_COLS/3))                                                     
PRINT_FORMAT="%"$COLS_PER_COL"s%""s\n"                                          

for i in "${!IP[@]}"; do                                                        
  k=${IP[$i]}                                                                   
  printf "$PRINT_FORMAT" "$k :" " $YELLOW${OP[$k]}$ENDCOL"                      
done