#!/bin/sh#--------------------------------------------------#Author: created by randolph 2016/10/21#blog:http://randolph.blog.51cto.com#function: this scripts function is create|remove#version:4.1.2#--------------------------------------------------. /etc/init.d/ functions_path=/tmp/startread -t 12 -p "please input a string:{start|stop| restart}: " stringfunction start () { if [ -f $_path ] ; then echo "File is exist." else /bin/touch $_PATH action "create a file successfully ..." /bin /true fi}function stop () { if [ -f $_path ]; then /bin/rm -fr $_path action "remove file successfully ..." /bin/true else echo "File no exist." action "Remove file fail ..." / bin/false fi}case $STRING in start) start ;; stop) stop ;; restart) stop start ;; *) echo echo -e "\033[31;5m $0 usage:{start|stop|restar}\033[0m" echo ;; Esac
This article from "Randolph" blog, reproduced please contact the author!
Read if case