Could you post the entire script? I'm wondering why the shell does not perform globbing on the *.
You should choose the number 1, 2 and so on:
Code:
% head *sh
==> BP.sh <==
echo $0
==> DB.sh <==
echo $0
==> LK.sh <==
echo $0
==> TB.sh <==
echo $0
% cat s
#! /bin/sh
PS3='choose a script: '
select s in *sh; do
./"$s"
break
done
% ./s
1) BP.sh
2) DB.sh
3) LK.sh
4) TB.sh
choose a script: 1
./BP.sh
You could also change the code like this:
Code:
#! /bin/sh
PS3='choose a script: '
select s in *sh; do
[ -e "$s" ] && ./"$s"
break
done