Run as ./script.sh /tmp/test or perhaps ./script.sh if you are in /tmp/test and scritp.sh lives there.
#!/bin/bash
path_base="${@:-.}"
for f in "${path_base}"/*war.*; do
name="${f##*/}" # strip path
name="${name%.war.*}" # clean name
name="${name%-[0-9]*}" # strip versioning is any
state="${f##*.}" # obtain state
printf "%-25s %s\n" "$name" "$state"
done
This produces output in alphabetic order (instead of reverse modification time order) and the line shown in red does not appear in the output you said you wanted. Since most of the names you provided only contain two decimal points, I don't see how your code produced the output you said it did, but maybe this will give you some other ideas for extracting the data you want. If reverse time order is important, you could also try:
#!/bin/bash
cd /tmp/test
ls -tr *war.* | while IFS= read -r file
do printf '%-25s %s\n' "${file%%.*}" "${file##*.}"
done
align Align columns of text. (what)
Path : ~/p/stm/common/scripts/align
Length : 270 lines
Type : Perl script, ASCII text executable
Shebang : #!/usr/bin/perl
Help : probably available with --help