Just take this code as an example. Pretending it is an HTML/text file, if I would like to know the total number of times that echo
appears, how can I do it using bash?
new_user()
{
echo "Preparing to add a new user..."
sleep 2
adduser # run the adduser program
}
echo "1. Add user"
echo "2. Exit"
echo "Enter your choice: "
read choice
case $choice in
1) new_user # call the new_user() function
;;
*) exit
;;
esac
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…