I guess no one bothered with this, or did not run it from the GUI if they did.
There was a problem where the modification test was run before gedit was closed, thus no change was noted and the modification was not copied in to the
user's home dir.
I fixed this, and also changed the test to see whether mantext had been invoked from the CLI or GUI to make it more portable. Now it should work
correctly whether or not $COLORTERM exists, i.e. it should not matter what terminal emulator you use, nor which graphical desktop, nor which distro...
I also added a notification that Orca will read if you run mantext from your dash or any GUI run dialog.
Again, I may at some point add some more functionality, but would appreciate a tester or two to make sure I've not overlooked anything with the attached
version.
BTW, I changed the name from manshow to mantext on my production box, so will attach it as such instead of as manshow as the version I sent to these
lists a couple daze ago was called.
I think this is now ready for inclusion in Vinux, and also plan to make it available for ARch and perhaps other distros so please give it a quick
testdrive.
Thanks,
--
B.H.
Registerd Linux User 521886
B. Henry wrote:
Sun, Feb 21, 2016 at 03:39:32PM -0600
> #!/bin/bash
> #this script accepts 1 and only 1 argument, a man topic.
>
> ## Variable(s) and function(s)
> MF="man-$1.txt"
>
> ## Comparison function
> ## Check manpage .txt file for modification/Save a copy in $HOME if found
> DifTest() {
> BACK="$(stat -t /tmp/
man.org|cut -d ' ' -f2)"
> WORK="$(stat -t /tmp/$MF|cut -d ' ' -f2)"
>
> if [[ $BACK != $WORK ]]; then
> cp /tmp/$MF $HOME/$MF
> echo "Your modified $1 manpage text has been written to
> $HOME/$MF"
> fi
> }
>
> ## *Go to work
> if [[ $# -ne "1" ]] ; then
> echo "Usage: manshow manpage"
> exit 1
> fi
>
> ## Write the manpage to a .txt file and make a backup copy
> ## for comparison in modification test
> man $1 > /tmp/$MF && cp /tmp/$MF /tmp/
man.org
>
> ## check if the file has anything in it and open if so.
> if [[ -s /tmp/$MF ]] ; then
> #select gedit if it is available, if not use nano.
> #There's probably a much better way to do this.
> #For now we just check for the existance of the $COLOR term variable.
> if [[ -n $COLORTERM ]] ; then
> gedit /tmp/$MF&
> else
> nano /tmp/$MF
> wait
> fi
> DifTest
> fi
> exit=0