So finally yesterday I took up Microsoft's option of reinstalling a clean version of Windows 10 while keeping workfiles. (Nevertheless, I still took a system backup.) Of course, I had to spend considerable time reinstalling/configuring my applications.
One of the problems I ran into was reinstalling an application I've used in random quote email signatures, which I discussed in an earlier post. For some reason, I ran into a Net Framework compatibility issue. (The Qliner publisher, to the best of my knowledge, has abandoned the software with no recent updates.)
On the other hand, I discovered on a geek web post that Microsoft was implementing a (beta) subsystem for Linux (Windows features toggle switch via Control Panel) . I've been professionally writing Unix shell scripts, a far more powerful, flexible alternative to Windows batch files, for over 20 years, and of course there have been PC implementations of Unix/Linux, including cygwin. This beta subsystem is not done by default; you also need to switch into developer mode via system settings (for developers section under Updates and Security). (Microsoft then downloads some of the Ubuntu Linux variant software and wants you to reboot thereafter.)
I'm not going to write a Unix shell script tutorial here. Let me simply outline a fairly simple solution. I took an html file with boilerplate before and after the random selection of a line from a quotes file ron2.txt (1 line per quote), which I had to used to customize quote selection in Qliner. I split the html file into two parts, test2 and test3. (Test2 includes the formatted signature header, and test3 has my name and contact information.) The key to my solution to selection of a random quote is the Ubuntu shuf.command.
I can call my Bash shell script newquote.sh from a Windows batch file (newquote.bat):
bash -c "/mnt/c/Users/'Ronald Guillemette'/Dropbox/newquote.sh"
And here is the shell script newquote.sh:#!/bin/bashI have gone into Window task scheduler to have this task run every 15 minutes. I can easily modify the base source html file (for test2 and test3) and I maintain ron2.txt in Notepad++.
tpath="/mnt/c/Users/Ronald Guillemette/Dropbox"
cd "$tpath"
shuf -n 1 ron2.txt> nq
cat test2.HTM > new.HTM
cat nq >> new.HTM
cat test3.HTM >> new.HTM