Source From Here
- goscript.sh- #!/bin/bash
- read -r -p "Enter name of script: " script
- read -r -p "Whats your fullname: " fname
- read -r -p "Whats the description of this script: " description
- script_dir_path="$HOME/ps/"
- if [ ! -d $script_dir_path ]; then
- mkdir ${script_dir_path}
- fi
- script_path="${script_dir_path}/${script}"
- echo "Preparing ${script_path}"
- echo "#!/bin/bash" > "${script_path}"
- echo
- echo "###########################################" >> ${script_path}
- echo
- echo "#Author: " $fname >> ${script_path}
- echo
- echo "#Date: " $(date) >> ${script_path}
- echo
- echo "#Description: " $description >> ${script_path}
- echo
- echo "#Modified: " $(date) >> ${script_path}
- echo
- echo "###########################################" >> ${script_path}
- echo
- chmod a+x ${script_path}
- vim ${script_path}
* Linuxize - Bash read Command
沒有留言:
張貼留言