Sample Header Ad - 728x90

Case statement allow only alphabetic characters?

2 votes
3 answers
5834 views
case "$1" in all) echo "$1" ;; [a-z][a-z][a-z][a-z][a-z][a-z]) echo "$1" ;; *) printf 'Invalid: %s\n' "$3" exit 1 ;; esac With this the only input accepted is all, and 6 characters. It won't accept 4 characters or more than 6. What I want to do here is to only allow characters, not digits or symbols, but of unlimited length. What is the correct syntax? Thanks
Asked by Freedo (1384 rep)
Jan 19, 2018, 02:31 PM
Last activity: Jan 8, 2023, 09:55 AM