Update post2blog.sh
This commit is contained in:
		
							
								
								
									
										15
									
								
								post2blog.sh
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								post2blog.sh
									
									
									
									
									
								
							| @@ -98,8 +98,9 @@ _title='Null' | ||||
| _outfile_end='Null' | ||||
| _savefile=0 | ||||
| _link_string="" | ||||
| _no_questions=0 | ||||
| #get arguments from terminal | ||||
| while getopts "hSi:l:T:c:t:s:" arg | ||||
| while getopts "hSVi:l:T:c:t:s:" arg | ||||
| do | ||||
| 	case $arg in | ||||
| 		h) | ||||
| @@ -113,6 +114,7 @@ do | ||||
| 			dispOptionShort "-t" "Blog tags that are separated by commas. The default is/are '${_tags}'." | ||||
| 			dispOptionShort "-s" "Sub-directory of the posts. The main directory of the posts is placed under '${_posts_address}' folder of your github.io directory. The default is '${_posts_sub_address}'." | ||||
| 			dispOptionShort "-S" "Save output markdown file. The default will remove the output file after committing the blog to Github." | ||||
| 			dispOptionShort "-V" "Don't ask me questions." | ||||
| 			dispOptionShort "-h" "Show help information." | ||||
| 			exit 0;; | ||||
| 		i) | ||||
| @@ -129,6 +131,8 @@ do | ||||
| 			_posts_sub_address=$OPTARG;; | ||||
| 		S) | ||||
| 			_savefile=1;; | ||||
| 		V) | ||||
| 			_no_questions=1;; | ||||
| 		?) | ||||
| 			printf "\e[1m\e[31mError ==>\e[0m Unknow argument.\n" | ||||
| 			printf "Use -h option to see help information.\n" | ||||
| @@ -251,8 +255,13 @@ echo "" >> ${_outfile} | ||||
| cat ${_tmpfile2} >> ${_outfile} | ||||
| rm ${_tmpfile2} | ||||
|  | ||||
| printf "Output file generated. Please check it. Is every thing ok? (y/n) " | ||||
| read _check_result | ||||
| if [[ ${_no_questions} == 0 ]]; then | ||||
| 	printf "Output file generated. Please check it. Is every thing ok? (y/n) " | ||||
| 	read _check_result | ||||
| else | ||||
| 	_check_result='y' | ||||
| fi | ||||
|  | ||||
| if [[ ${_check_result} == 'y' ]]; then | ||||
| 	#copy files to github.io directory. Check directory exists or not | ||||
| 	#"${_repository_address}/${_assets_address}`date +"%Y-%m"`" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user