Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
伪代码将是
for OUTPUT in $(ls -d */) do case $OUTPUT in 1 ) $OUTPUT ;; esac done *) echo -e "Oops!!! Please select a valid number";
不确定这是否可能,或者这是否有意义?
首先,不要解析ls. 只需使用 glob:
ls
for OUTPUT in */
其次,阅读文档中有关select命令的部分。bash
select
bash