Link now selected from a dynamic menu
This commit is contained in:
		
							
								
								
									
										37
									
								
								rss.sh
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								rss.sh
									
									
									
									
									
								
							@@ -2,19 +2,42 @@
 | 
				
			|||||||
set -euo pipefail
 | 
					set -euo pipefail
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")"
 | 
					 | 
				
			||||||
DATE="$(date -R)"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
source "${BASEDIR}/website.conf"
 | 
					source "${BASEDIR}/website.conf"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					shopt -s extglob
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")"
 | 
				
			||||||
 | 
					DATE="$(date -R)"
 | 
				
			||||||
 | 
					LINKS=($(find -P "${WEBROOT}/blog/" | grep 'index\.html' | grep -v 'blog/index\.html' | sed 's|index.html||g; s|.*/blog|blog|g' | sort))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					MENU="@(${LINKS[0]}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for ((i=1;i<${#LINKS[@]};i++)); do
 | 
				
			||||||
 | 
						MENU+="|${LINKS[${i}]}"
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					MENU+=")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					printf 'Select the link you wish to use\n'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					select LINK in "${LINKS[@]}"
 | 
				
			||||||
 | 
					do
 | 
				
			||||||
 | 
						case ${LINK} in
 | 
				
			||||||
 | 
						${MENU})
 | 
				
			||||||
 | 
							break
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
						*)
 | 
				
			||||||
 | 
							printf \
 | 
				
			||||||
 | 
								'Invalid option\n'
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
						esac
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
printf 'Title of blog post:\n'
 | 
					printf 'Title of blog post:\n'
 | 
				
			||||||
read -r TITLE
 | 
					read -r TITLE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
printf 'Link to blog post:\n'
 | 
					 | 
				
			||||||
read -r LINK
 | 
					 | 
				
			||||||
LINK="$(printf "${LINK}" | sed 's|^/||')"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
printf 'Description of blog post:\n'
 | 
					printf 'Description of blog post:\n'
 | 
				
			||||||
read -r DESCRIPTION
 | 
					read -r DESCRIPTION
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user