|!Punctuation|!Location|!Function|\n|{{{@@...@@}}}|surrounding text|@@highlighted text@@|\n|{{{//...//}}}|surrounding text|//italicized text//|\n|{{{==...==}}}|surrounding text|==strikethrough text==|\n|{{{''...''}}}|surrounding text|''boldfaced text''|\n|{{{__...__}}}|surrounding text|__underlined text__|\n|{{{[[text|url]]}}}|around text/url pair|[[text|http://gri.gallaudet.edu/]] link to url|\n|{{{ {...} }}}|''__tripled__'' surrounding text|{{{in-line literal text}}}|\n|{{{ {...} }}}|''__tripled__'' surrounding ''__lines__''|literal block|\n|{{{<<<}}}|surrounding ''__lines__''|blockquotes|\n|{{{!}}}|at start of line|subheading|\n|{{{|...|...|}}}|line sectioned by vertical bars|table row|\n|{{{!}}}|in a table|!table heading|\n|{{{----}}}|alone on line|horizontal rule|\n|{{{*}}}|at start of line|bulleted list item|\n|{{{#}}}|at start of line|numbered list item|\nsource: Kevin Cole, January 2007
TTiddlyWiki uses Wiki style markup, a way of lightly "tagging" plain text so it can be transformed into HTML. Edit this Tiddler to see samples.\n\n! Header Samples\n!Header 1\n!!Header 2\n!!!Header 3\n!!!!Header 4\n!!!!!Header 5\n\n! Unordered Lists:\n* Lists are where it's at\n* Just use an asterisk and you're set\n** To nest lists just add more asterisks...\n***...like this\n* The circle makes a great bullet because once you've printed a list you can mark off completed items\n* You can also nest mixed list types\n## Like this\n\n! Ordered Lists\n# Ordered lists are pretty neat too\n# If you're handy with HTML and CSS you could customize the [[numbering scheme|http://www.w3schools.com/css/pr_list-style-type.asp]]\n## To nest, just add more octothorpes (pound signs)...\n### Like this\n* You can also\n** Mix list types\n*** like this\n# Pretty neat don't you think?\n\n! Tiddler links\nTo create a Tiddler link, just use mixed-case WikiWord, or use [[brackets]] for NonWikiWordLinks. This is how the GTD style [[@Action]] lists are created. \n\nNote that existing Tiddlers are in bold and empty Tiddlers are in italics. See CreatingTiddlers for details.\n\n! External Links\nYou can link to [[external sites|http://google.com]] with brackets. You can also LinkToFolders on your machine or network shares.\n\n! Images\nEdit this tiddler to see how it's done.\n[img[http://img110.echo.cx/img110/139/gorilla8nw.jpg]]\n\n!Tables\n|!th1111111111|!th2222222222|\n|>| colspan |\n| rowspan |left|\n|~| right|\n|colored| center |\n|caption|c\n\nFor a complex table example, see PeriodicTable.\n\n! Horizontal Rules\nYou can divide a tiddler into\n----\nsections by typing four dashes on a line by themselves.\n\n! Blockquotes\n<<<\nThis is how you do an extended, wrapped blockquote so you don't have to put angle quotes on every line.\n<<<\n>level 1\n>level 1\n>>level 2\n>>level 2\n>>>level 3\n>>>level 3\n>>level 2\n>level 1\n\n! Other Formatting\n''Bold''\n==Strike==\n__Underline__\n//Italic//\nSuperscript: 2^^3^^=8\nSubscript: a~~ij~~ = -a~~ji~~\n@@highlight@@\n@@color(green):green colored@@\n@@bgcolor(#ff0000):color(#ffffff):red colored@@\n
Visual Bash
a modest and seriously tongue-in-cheek proposal
[[VisualBash]]\n[[overview]]
[[Shell Qualifiershttps://en.wikipedia.org/wiki/Binfmt_misc]] are elements you can add to shell scripts to enhance system operation, examples include:\n\n|!Phonem |!Description |! Element |\n|shebang |Establishing command processor | {{{#!}}} |\n|shebout |Identify expos-able help line | {{{##}}} |\n|sheborg |Identify structural element | {{{#*}}} |\n|sheblog |Toggle Logging in script | {{{#>}}} |\n|shebug |Indicte Location of debugging code | {{{#D}}} |\n\n\n[[shebang|https://en.wikipedia.org/wiki/Shebang_(Unix)]]\nEstablishing command processor\n{{{\n#!\n}}}\n\nshebout\nIdentify expos-able help line\n{{{\n##\n}}}\n\nsheborg\nIdentify structural line\n{{{\n#*\n}}}\n\nsheblog\nIdentify line to be appended to allow for logging\n{{{\n#>\n}}}\n\nand if you need to actually carry html in the script:\n{{{\n#html\n}}}\n\n
This is the template as it stands Sunday, November 25 2012\n\nThis is released under [[GPL I|http://www.gnu.org/licenses/old-licenses/gpl-1.0.html]]\n\n{{{\n#!/bin/bash\n# pflint Fri Sep 14 10:29:19 EDT 2012\n# pflint Mon 05 Nov 2012 09:14:14 AM EST Added standard functions\n# pflint Tue 27 Nov 2012 08:35:47 AM EST Added security variables\s]\n# pflint Mon 15 Apr 2013 09:00:27 AM EDT check for passwords\n# pflint Sun 27 Oct 2013 07:57:50 PM EDT better dummy\nversion="1.0"\n#\n# hold environment\nexport S=$PWD\n#* move to the appropriate directory\n# cd ??\n#\n#* check location of vital files and programs, sanity check\n# ??\n#\n# Define files to be used\n# uid="" ; if [ "$uid" == "" ]; then echo "Set user id!"; exit; fi\n# passwd="" ; if [ "$passwd" == "" ]; then echo "Set user passwd!"; exit; fi\n# ??\n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is "$0" "$version\ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this documentation when you put in the wrong number of arguments...\n## The name of this program is template.sh, a collection of general purpose tools.\n## for managing printing at the VDOL. This is released under GPL I\n## The syntax is:\n## - template.sh dummy tests the dummy function\n## Output is delivered to the screen...\n## - template.sh pause <message> displays message and with enter exits normally\n## - template.sh wait <n> <filename> where "n" is\n## - template.sh get <n> <message> where "n" is wait time,displays message\n## and exits normally\n## - template.sh get <n> <filename> where "n" is\n## - template.sh get all <n> where "n" is typically\n## Output is delivered to the directory you are in...\n## For structure information type "grep '^\s#\s*' template.sh"\n## :^)\n## (C) P Flint, Vermont Department of Labor Liscensed under GPLI\n##\n# *****Documentation Loop ends here the rest is function******\n#\n} # Test: template.sh\n#\n#\n#* function dummy - Dummy basic function template. ajm1Rename and fill stuff in between braces\nfunction dummy(){\necho "In $0 version $version this is the \s"$FUNCNAME\s" function"\n# echo "This is the dummy function"\n} # Test:\n#\n#*######################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#\n#* function dir - this directory function is very specific as to what directory and what target\nfunction dir(){\n#debug echo $#" "$var1" "$var2" "$var3" "$var4" "$ARGS\ntarg2=$(echo $var2 | tr '[:lower:]' '[:upper:]')\n# echo $var2" "$targ2\ntarg3=$(echo $var3 | tr '[:lower:]' '[:upper:]')\n# echo $var3" "$targ3\nif [ "$var4" = "now" ]; then cdate=$(echo $(date +%b\s %d)); else cdate=$(echo $var4 | tr '[:lower:]' '[:upper:]'); fi\necho $var4" "$cdate\necho -n "This dir function is specific to the directory that "$targ2" files in "\necho "LECS2:ADP/VSELIB/USRLIB2/AFP22/ filtered for "$targ2\ncase "$ARGS" in\n "4") echo "...additionally filtered for "$targ3" dated "$cdate; curl ftp://$uid:$passwd@159.105.80.205/ADP/VSELIB/USRLIB2/AFP22/ 2>/dev/null | grep -i $var2 | grep -i $var3 | grep -i "$cdate" | cut -c 26- ;;\n "3") echo "...additionally filtered for "$targ3 ; curl ftp://$uid:$passwd@159.105.80.205/ADP/VSELIB/USRLIB2/AFP22/ 2>/dev/null | grep -i $var2 | grep -i $var3 | grep -i "$cdate" | cut -c 26- ;;\n "2") echo "...and additionally filtered for "$var3; curl ftp://$uid:$passwd@159.105.80.205/ADP/VSELIB/USRLIB2/AFP22/ 2>/dev/null | grep -i $targ2 | grep -i $var2 | cut -c 26- ;;\n "1") curl ftp://$uid:$passwd@159.105.80.205/ADP/VSELIB/USRLIB2/AFP22/ 2>/dev/null | grep -i $targ2 | cut -c 26-;;\nesac # end of choices\necho "finished"\n} # Test: template.sh dir\n#\n#\n# copy files to mainframe\n#* function rename- Renames the PHASE file PHAOK or optionally the file name of your choice\nfunction rename(){\necho "renaming "$oldname" to "$newname\npause "Are you ready?"\n/usr/bin/curl -I "ftp://$uid:$passwd@159.105.80.205/ADP/VSELIB/USRLIB2/AFP22/" -Q "-RNFR $curname" -Q "-RNTO $newname" # rename from PHASE to PHAOK\n} # Test:\n#\n#* function spause- A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n\n}\n#\n#* function pause - Allows many ways to tarry...\nfunction pause(){\n#debug echo "Vairables in Pause are: "\n#debug echo $#" "$1" "$ARGS\n # -t sets time\n # read -t $var3 -p "$*" ans\ncase "$ARGS" in\n "6") read -t $time -p "$prompt";;\n "5") read -p "$prompt";;\n "1") read;;\nesac # end of choices\n # echo $ans\n} # TESTS: template.sh pause; template.sh pause "Testing wait"; template.sh pause 3 "Testing 1,2,3";/manage_main\n#\n#\n#* function listful-This function checks to make certian you have appropriate files\nfunction listful(){\n# echo "This is the listful function"\n#debug echo $#" "$1" "$ARGS\nif [ ! -e "$list" ] ; then\n clear\n echo "The path to ICCFLIST.TXT must be right for $0 to work..."\n echo ""${var2:0:$((${#var2}-3))}\n echo "Sadly, the file "$list" does not exist"\n read -p "Please change the current path \s($list\s): " -e list\n # echo "test it again"\n # ARGS="5"\n listful\nelse\n echo ""\nfi # listful\n} # Test: $0 listfull\n#\n#* function get - This downloads single ICCF files from specific libraries\nfunction get()\n{\necho "The file we are downloading from " $LIB" is: "$FILE\ncurl -s ftp://$uid:$passwd@159.105.80.225//ADP/DWN/ICCF/$LIB/$FILE -o $FILE".iccf."$LIB".txt"\n# echo " is downloaded" |tee --append ../../sendjcl.log\nls -alt | grep $FILE | cut -c\n26- #>> ../../sendjcl.log\n} # end of get function\n#\n#* function cleanup-Cleanup function deletes all temporary files\nfunction cleanup(){\necho "This is the cleanup function"\n# Clean up stuff used in this function\n# Remove buffers\nrm iccf.first.half iccf.second.half iccflist$LIBR.txt $LIBR.iccf.column 2>/dev/null\n# rm $1 # removes the target file...\n# mv $1 ../../$1 # instead, moves the target file to ../../$1\n# mv $1 ../../$1"_"$(date +%Y-%m-%d) # most severe, moves the target file to ../../$1\n} # Test:\n#\n#* function camd - Check and manuipulate days\nfunction camd()\n{\n# if [ $($1 +%u) -ne "1" ]; then\n# echo $(date --date=$1 +%u)\nif [ $(date --date=$DATE +%u) -eq "1" ]; then\n echo "I suppose it is Monday";\n bin/2stap.sh $DATE # do today, Monday\n DATE=$(date --date=$DATE"-3day" +%m/%d/%Y ) # do Friday\n else\n echo "it is not Monday";\n fi # test for Mondayness...\n} # end of cass- monday-monday\n#\n#* function fwatch - Watches the end of a file indefinitely\nfunction fwatch(){\necho $#" "$var2" "$ARGS\n watch tail -20 $var2\n} # Test: template.sh fwatch var/log/messages\n#\n#* This downloads single files as in the listing\nfunction get(){\necho "The file we are downloading from " $LIB" is: "$FILE\ncurl -s ftp://$uid:$passwd@159.105.80.225//ADP/DWN/ICCF/$LIB/$FILE -o $FILE".iccf."$LIB".txt"\n} # Test: template.sh get\n#\n#* function cleanup - cleanup function deletes all temporary files\nfunction cleanup(){\necho "This is the cleanup function"\necho $#" "$ARGS\n#* Clean up stuff used in this function\n#* Remove buffers\nrm iccf.first.half iccf.second.half iccflist$LIBR.txt $LIBR.iccf.column 2>/dev/null\n# rm $1 # removes the bin/template.sh wait "..go on" 5target file...\n# mv $1 ../../$1 # instead, moves the target file to ../../$1\n# mv $1 ../../$1"_"$(date +%Y-%m-%d) # most severe, moves the target file to ../../$1\n} # Test:\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\necho "template.sh v 0.2 starts"\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n# ARGS=$# # carries the number of args into the functions...\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "pause" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "pause" ]; then ARGS="5"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "pause" ]; then ARGS="6"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "fwatch" ]; then ARGS="2"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "get" ]; then ARGS="6"; fi\nif [ "$#" -eq "4" ] && [ "$1" = "dir" ]; then ARGS="4"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "dir" ]; then ARGS="3"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "dir" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dir" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "tlog" ]; then ARGS="9"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "cleanup" ]; then ARGS="9"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "listful" ]; then ARGS="9"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "wait" ]; then ARGS="6"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#debug echo $#" "$1" "$2" "$3" "$ARGS #debug\n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; cat $0 | grep '^## ' | sed -e 's/##//'; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") clear; echo $ARGS" Your function here" ;; # Spare for capacity\n "8") clear; echo $ARGS" Your function here" ;; # Spare for capacity\n "9") clear; echo $ARGS" Your function here" ;; # Spare for capacity\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. To TEST:\n#\n# echo " ";\necho "template.sh stops"\n# That's all folks!!\n# Junk shop\n# if [ "$#" -eq "3" ] && [ "$1" = "get" ] && [ "$2" = "all" ]; then ARGS="7"; fi\n# "2") secs=$2; while read line ; do $1; done;; # read from a file and process\n# *) clear; cat $0 | grep '^## ' | sed -e 's/##//'; exit 1;;\n#* restore environment\ncd $S\n\n}}}\n\n! Notes\n# This demonstration code should run if it is chmoded +x\n/manage_main
This script, age.sh is built on the framework, and can be used to track backup files.\n\n\nNote: this code should run if it is chmoded +x\n{{{\n#!/bin/bash\n# pflint Fri Sep 14 10:29:19 EDT 2012\n# pflint Mon 05 Nov 2012 09:14:14 AM EST Added standard functions\n# pflint Tue 27 Nov 2012 08:35:47 AM EST Added security variables\n# age.sh is based upon these conventions:\n# 1. All backup files are gzipped files named by their slice.\n# 2. These are contained in directories typically about 9 GB\n# 3. Backup files are named "year-mm-dd-backup"\n# 4. Monthly pulls from these root files are named in this pattern "mon-year.bu"\n# 6. Monthly pull directories should contain three directories each;\n# a. One from the beginning of the month\n# b. One from the middle of the month\n# c. One from the end of the month\n# 5. Yearly collections are in directories "year"\n# Thu 29 Nov 2012 08:33:51 AM EST subroutine name change\n# \nversion="1.1"\n#\n# hold environment\nexport S=$PWD\n#* move to the appropriate directorygrep '^\s#\s*' age.sh\n# cd ??\n#\n#* check location of vital files and programs, sanity check\n# ??\n#\n# Define files to be used\n# uid="" ; if [ "$uid" == "" ]; then echo "Set user id!"; exit; fi\n# passwd="" ; if [ "$passwd" == "" ]; then echo "Set user passwd!"; exit; fi\n# ??\n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is "$0" "$version\ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this documentation when you put in the wrong number of arguments...\n## The name of this program is age.sh, a collection oftools for aging out.\n## Disaster Recovery and Development files on Gompers at the Burlington VDOL \n## office. This is released under GPL I\n## The syntax is:\n## - age.sh status details what the current situation is\n## - age.sh stmnth <1-12> details a current or default month\n## in bothe of these, Output is delivered to the screen...\n## - age.sh mvmnth [1-12] [test/make] does a monthly cleanup, \n## based upon the criteria, optionally selects month and test. \n## Output actions are delivered to the screen...\n## - age.sh mkmnth [test/make] [1-12] makes a current month \n## directory, optionally selects month, \n## - age.sh domnth [1-12] [test] makes month directory and \n## moves in the specified three directories.\n## - age.sh mkyr [year] makes a year directory, optionally \n## selects year, moves all months in, and exits normally.\n## - age.sh cleanup [test] optionally a rehersal\n## Output is delivered to the directory you are in...\n## - age.sh get <n> <filename> where "n" is\n## - age.sh dummy tests the dummy function\n## Output is delivered to the screen...\n## For structure information type "grep '^\s#\s*' age.sh"\n## :^)\n## (C) P Flint, Vermont Department of Labor Liscensed under GPLI\n##\n# *****Documentation Loop ends here the rest is function******\n#\n} # Test: age.sh\n#\n#* function dummy - Rename and fill stuff in between braces\nfunction dummy(){\necho "This is the dummy function"\n} # Test:\n#\n#\n#* function status - Gives a status indication of the backup area...\nfunction status(){\necho "This is the status function"\nfor i in {1..12}\ndo \n # echo $i\n valf=$(printf "%.2d" "$i")\n echo "Directories unfiled for "$(year=$(date +%y) ; echo $(date --date="$valf/1/$year" +%B|tr [:upper:] [:lower:]))" are:"\n # ls -1 | grep backup |grep "\s-$valf\s-" \n ls -1 | grep backup | grep -e "\s-$valf\s-" | grep -v "\s-$valf\s-backup"\n spause\ndone\n} # Test:\n#\n#* function stmnth - Gives a status indication of the backup area for a paticular month...\nfunction stmnth(){\n#debug echo "This is the stmnth function"\necho "The current location is: "$PWD\nmonth=$(printf "%.2d" "$dmonth")\necho "Directories unfiled for "$(year=$(date +%y) ; echo $(date --date="$month/1/$year" +%B|tr [:upper:] [:lower:]))" are:"\n# ls -1 | grep backup | grep -e "\s-$month\s-" | grep -v "\s-$month\s-backup"\ndu -h --max-depth=1 2>/dev/null | grep backup | grep -e "\s-$month\s-" | grep -v "\s-$month\s-backup"\nspause\necho "Directories in "$PWD"/"$dname" are:"\ndu -h --max-depth=1 2>/dev/null $dname\n} # Test: age.sh stdmnth 11\n#\n#* function defvbl - default variables for no arguments\nfunction defvbl(){\n#debug echo "This is the defvbl function" #debug \n#debug echo $#" "$var1" "$var2" "$var3" "$ARGS #debug \ndmonth=$(date +%m); # month is the current month\ndname=$(year=$(date +%Y) ; echo $(date +%b|tr [:upper:] [:lower:]))"-"$(date +%Y)".bu" # current\necho "The month is: "$dmonth\necho "the backup location is: "$dname\n} # Test:\n#\n#\n#* function waiw - figures out which argument is which...\nfunction waiw(){\n#debug echo $#" "$var1" "$var2" "$var3" "$ARGS \n#debug echo "This is the waiw function"\nif [ "$var2" -eq "$var2" ] 2>/dev/null; then\n echo "The first variable is a number so it is the month"; dmonth=$var2; dtest=$var3\nelse\n echo " the first variable is not a number so it is the test directive"; dmonth=$var3; dtest=$var2\nfi\n#\nif [[ $dmonth -lt 1 || $dmonth -gt 12 ]]; then echo "out of range using default"; dmonth=$(date +%m); fi\nmonth=$dmonth\ndname=$(year=$(date +%Y) ; echo $(date --date="$month/1/$year" +%b|tr [:upper:] [:lower:]))"-"$(date +%Y)".bu"\necho "The month is: "$dmonth\necho "The test directive: "$dtest\necho "the backup location is: "$dname\n} # Test: age.sh waiw\n#\n#* function domnth - Rename and fill stuff in between braces\nfunction domnth(){\necho "This is the domnth function"\n#debug echo $#" "$var1" "$var2" "$var3" "$ARGS \n\n} # Test:\n#\n#\n#* function mkmnth - makes a directory for the particular month\nfunction mkmnth(){\nif [ "$(echo "$dtest" | tr [:lower:] [:upper:])" == "TEST" ];\nthen\n echo "If this were not a test I would have made a directory with the name "$dname \n # ls -alt \n exit 1 \nfi\necho "Just made a directory called "$dname" see?"\nmkdir $dname\nls -alt $dname\n} # Test:\n\n#\n#* function mvmnth - Select directories to keedefvblp and move them. Note TEST function\nfunction mvmnth(){\necho "This is the mvmnth function"\n#\nmonth=$(printf "%.2d" "$dmonth")\necho "The month is mvmnth is "$month\nhalf=$(( $(ls -1 | grep backup | grep "\s-$month\s-" | wc -l)/2 ))\nbegdir=$(ls -1 | grep backup | grep "\s-$month\s-" | head -1)\nmiddir=$(ls -1 | grep backup | grep "\s-$month\s-" | sed $half'q;d')\nenddir=$(ls -1 | grep backup | grep "\s-$month\s-" | tail -1)\nif [ "$(echo $dtest | tr [:lower:] [:upper:])" == "TEST" ];\nthen\n echo "I was only kidding! of the $(ls -1 | grep backup | grep "\s-$month\s-"|wc -l) files available"\n echo "here are the directories we would have moved." \n echo -e "First of the month: "\s\st$begdir\n echo -e "Middle of the month: "\s\st$middir\n echo -e "Last of the month: "\s\st$enddir\n exit 1 \nfi\necho "I am not kidding! here are the directories we are about to move:" \necho -e "First of the month: "\s\st$begdir\necho -e "Middle of the month: "\s\st$middir\necho -e "Last of the month: "\s\st$enddir\n# ARGS="5"; prompt="Ready to do this?" ;pause \nspause\nfor save in $begdir $middir $enddir\ndo\n dest=$dname"/"$save\n echo "moving "$save" to "$dest\n mv $save $dest #debug \ndone \n} # Test: age.sh mvmnth\n#\n#\n#* function cleanup - Cleanup function deletes all the day directories in current directory\nfunction cleanup(){\n#debug echo "This is the clean up function"\n#debug echo $#" "$var1" "$var2" "$var3" "$ARGS \n# Clean up stuff that remains in the current directory note TEST function\nvalf=$(printf "%.2d" "$dmonth"); #debug echo $dmonth $month $valf\ndirno=$(ls -1 | grep backup | grep -e "\s-$valf\s-" | grep -v "\s-$valf\s-backup" | wc -l)\n#\nif [ "$(echo $dtest | tr [:lower:] [:upper:])" == "TEST" ];\nthen\n echo "I was only kidding! We would have erased these $dirno directories:" \n du -h --max-depth=1 2>/dev/null | grep backup | grep -e "\s-$valf\s-" | grep -v "\s-$valf\s-backup" \n exit 1 \nfi\necho "we are cleaning these up now:"\n# ls -1 | grep backup | grep -e "\s-$month\s-" | grep -v "\s-$valf\s-backup"\ndu -h --max-depth=1 2>/dev/null | grep backup | grep -e "\s-$valf\s-" | grep -v "\s-$valf\s-backup" \nspause\necho "Deleting the following:"\nls -1 | grep backup | grep -e "\s-$valf\s-" | grep -v "\s-$valf\s-backup"\nls -1 | grep backup | grep -e "\s-$valf\s-" | grep -v "\s-$valf\s-backup" |xargs -I xxx rm -rf xxx\n} # Test: age.sh cleanup\n#\n# \n#*######################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\n#* function pause - Allows many ways to tarry...\nfunction pause(){\n#debug echo "Vairables in Pause are: "\n#debug echo $#" "$-e 1" "$ARGS \n # -t sets time\n # read -t $var3 -p "$*" ans$(ls -1 | grep backup |wc -l)\ncase "$ARGS" in\n "6") read -t $time -p "$prompt";;\n "5") read -p "$prompt";;\n "1") read;;\nesac # end of choices\n # echo $ans\n} # TESTS: age.sh pause; age.sh pause "Testing wait"; age.sh pause 3 "Testing 1,2,3";\n#\n#* function camd - Check and manuipulate days\nfunction camd()\n{\n# if [ $($1 +%u) -ne "1" ]; then\n# echo $(date --date=$1 +%u)\nif [ $(date --date=$DATE +%u) -eq "1" ]; then\n echo "I suppose it is Monday";\n bin/2stap.sh $DATE # do today, Monday\n DATE=$(date --date=$DATE"-3day" +%m/%d/%Y ) # do Friday\n else\n echo "it is not Monday";\n fi # test for Mondayness...\n} # end of cass- monday-monday\n#\n#* function fwatch - Watches the end of a file indefinitely\nfunction fwatch(){\n#debug echo $#" "$var2" "$ARGS\n watch tail -20 $var2\n} # Test: age.sh fwatch var/log/messages\n#\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\necho "age.sh v 0.2 starts"\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n# ARGS=$# # carries the number of args into the functions...\nif [ "$#" -eq "1" ] && [ "$1" = "status" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "domnth" ]; then ARGS="7"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "domnth" ]; then ARGS="8"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "domnth" ]; then ARGS="9"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "mkmnth" ]; then ARGS="7"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "mkmnth" ]; then ARGS="8"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "mkmnth" ]; then ARGS="9"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "mvmnth" ]; then ARGS="7"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "mvmnth" ]; then ARGS="8"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "mvmnth" ]; then ARGS="9"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "stmnth" ]; then ARGS="7"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "stmnth" ]; then ARGS="8"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "pause" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "pause" ]; then ARGS="5"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "pause" ]; then ARGS="6"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "waiw" ]; then ARGS="2"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "waiw" ]; then ARGS="3"; fi\nif [ "$#" -eq "4" ] && [ "$1" = "dir" ]; then ARGS="4"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "dir" ]; then ARGS="3"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "dir" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dir" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "cleanup" ]; then ARGS="7"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "cleanup" ]; then ARGS="8"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "cleanup" ]; then ARGS="9"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "defvbl" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#debug echo $#" "$1" "$2" "$3" "$ARGS \n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; cat $0 | grep '^## ' | sed -e 's/##//'; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") defvbl; $1 ;; # run the command and default variables\n "8") var2=$2; waiw; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; waiw; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. To TEST:\n#\n# echo " ";\necho "age.sh stops"\n# That's all folks!!\n# Junk shop\n# if [ "$#" -eq "3" ] && [ "$1" = "get" ] && [ "$2" = "all" ]; then ARGS="7"; fi\n# "2") secs=$2; while read line ; do $1; done;; # read from a file and process\n# *) clear; cat $0 | grep '^## ' | sed -e 's/##//'; exit 1;;\n#* restore environment\ncd $S\n}}}
Maybe the better way to do this is to load a variable up...\n\n{{{\n#!/bin/bash\n# pflint Fri 17 May 2013 07:49:14 AM EDT \n# packs html into String\n#\nread -d '' String <<"EOF"\n-\n *****DOCUMENTATION*****\n You get this documentation when you put in the wrong number of arguments...\n The name of this program is template.sh, a collection of general purpose tools.\n for managing printing at the VDOL. This is released under GPL I\n The syntax is:\n - template.sh dummy tests the dummy function\n Output is delivered to the screen...\n - template.sh pause <message> displays message and with enter exits normally\n - template.sh wait <n> <filename> where "n" is\n - template.sh get <n> <message> where "n" is wait time,displays message\n and exits normally\n - template.sh get <n> <filename> where "n" is\n - template.sh get all <n> where "n" is typically\n Output is delivered to the directory you are in...\n For structure information type "grep '^\s#\s*' template.sh"\n :^)\n (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n\nEOF\n# echo "this is the string"\necho "$String"\n}}}
Below is Visual Bash TemPlate version 2.\n\n{{{\n#!/bin/bash\n# pflint Fri Sep 14 10:29:19 EDT 2012\n# pflint Thu 30 May 2013 08:07:14 AM EDT changed help section\nversion="20130530"\n#\n# hold environment\nexport S=$PWD\n#* move to the appropriate directory\n# cd ??\n#\n#* check location of vital files and programs, sanity check\n# ??\n#\n# Define files to be used\n# uid="" ; if [ "$uid" == "" ]; then echo "Set user id!"; exit; fi\n# passwd="" ; if [ "$passwd" == "" ]; then echo "Set user passwd!"; exit; fi\n# ??\n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is "$0" version "$version\n# cat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n# packs help into String\n#\nread -d '' String <<"EOF"\n-\n *****DOCUMENTATION*****\n You get this documentation when you put in the wrong number of arguments...\n The name of this program is vbtp2.sh, a collection of general purpose tools.\n for managing printing at the VDOL. This is released under GPL I\n The syntax is:\n - vbtp2.sh dummy tests the dummy function\n Output is delivered to the screen...\n - vbtp2.sh pause <message> displays message and with enter exits normally\n - vbtp2.sh wait <n> <filename> where "n" is\n - vbtp2.sh get <n> <message> where "n" is wait time,displays message\n and exits normally\n - vbtp2.sh get <n> <filename> where "n" is\n - vbtp2.sh get all <n> where "n" is typically\n Output is delivered to the directory you are in...\n For structure information type "grep '^\s#\s*' vbtp2.sh"\n :^)\n (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n\nEOF\necho "$String"\n} # Test: vbtp2.sh\n#\n#\n#* function dummy - Dummy basic function template. ajm1Rename and fill stuff in between braces\nfunction dummy(){\necho "This is the dummy function"\n} # Test:\n#\n#*######################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#\n#* function dir - this directory function is very specific as to what directory and what target\nfunction dir(){\n#debug echo $#" "$var1" "$var2" "$var3" "$var4" "$ARGS\ntarg2=$(echo $var2 | tr '[:lower:]' '[:upper:]')\n# echo $var2" "$targ2\ntarg3=$(echo $var3 | tr '[:lower:]' '[:upper:]')\n# echo $var3" "$targ3\nif [ "$var4" = "now" ]; then cdate=$(echo $(date +%b\s %d)); else cdate=$(echo $var4 | tr '[:lower:]' '[:upper:]'); fi\necho $var4" "$cdate\necho -n "This dir function is specific to the directory that "$targ2" files in "\necho "LECS2:ADP/VSELIB/USRLIB2/AFP22/ filtered for "$targ2\ncase "$ARGS" in\n "4") echo "...additionally filtered for "$targ3" dated "$cdate; curl ftp://$uid:$passwd@159.105.80.205/ADP/VSELIB/USRLIB2/AFP22/ 2>/dev/null | grep -i $var2 | grep -i $var3 | grep -i "$cdate" | cut -c 26- ;;\n "3") echo "...additionally filtered for "$targ3 ; curl ftp://$uid:$passwd@159.105.80.205/ADP/VSELIB/USRLIB2/AFP22/ 2>/dev/null | grep -i $var2 | grep -i $var3 | grep -i "$cdate" | cut -c 26- ;;\n "2") echo "...and additionally filtered for "$var3; curl ftp://$uid:$passwd@159.105.80.205/ADP/VSELIB/USRLIB2/AFP22/ 2>/dev/null | grep -i $targ2 | grep -i $var2 | cut -c 26- ;;\n "1") curl ftp://$uid:$passwd@159.105.80.205/ADP/VSELIB/USRLIB2/AFP22/ 2>/dev/null | grep -i $targ2 | cut -c 26-;;\nesac # end of choices\necho "finished"\n} # Test: vbtp2.sh dir\n#\n#\n# copy files to mainframe\n#* function rename- Renames the PHASE file PHAOK or optionally the file name of your choice\nfunction rename(){\necho "renaming "$oldname" to "$newname\npause "Are you ready?"\n/usr/bin/curl -I "ftp://$uid:$passwd@159.105.80.205/ADP/VSELIB/USRLIB2/AFP22/" -Q "-RNFR $curname" -Q "-RNTO $newname" # rename from PHASE to PHAOK\n} # Test:\n#\n#* function spause- A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n\n}\n#\n#* function pause - Allows many ways to tarry...\nfunction pause(){\n#debug echo "Vairables in Pause are: "\n#debug echo $#" "$1" "$ARGS\n # -t sets time\n # read -t $var3 -p "$*" ans\ncase "$ARGS" in\n "6") read -t $time -p "$prompt";;\n "5") read -p "$prompt";;\n "1") read;;\nesac # end of choices\n # echo $ans\n} # TESTS: vbtp2.sh pause; vbtp2.sh pause "Testing wait"; vbtp2.sh pause 3 "Testing 1,2,3";/manage_main\n#\n#\n#* function listful-This function checks to make certian you have appropriate files\nfunction listful(){\n# echo "This is the listful function"\n#debug echo $#" "$1" "$ARGS\nif [ ! -e "$list" ] ; then\n clear\n echo "The path to ICCFLIST.TXT must be right for $0 to work..."\n echo ""${var2:0:$((${#var2}-3))}\n echo "Sadly, the file "$list" does not exist"\n read -p "Please change the current path \s($list\s): " -e list\n # echo "test it again"\n # ARGS="5"\n listful\nelse\n echo ""\nfi # listful\n} # Test: $0 listfull\n#\n#* function get - This downloads single ICCF files from specific libraries\nfunction get()\n{\necho "The file we are downloading from " $LIB" is: "$FILE\ncurl -s ftp://$uid:$passwd@159.105.80.225//ADP/DWN/ICCF/$LIB/$FILE -o $FILE".iccf."$LIB".txt"\n# echo " is downloaded" |tee --append ../../sendjcl.log\nls -alt | grep $FILE | cut -c\n26- #>> ../../sendjcl.log\n} # end of get function\n#\n#* function cleanup-Cleanup function deletes all temporary files\nfunction cleanup(){\necho "This is the cleanup function"\n# Clean up stuff used in this function\n# Remove buffers\nrm iccf.first.half iccf.second.half iccflist$LIBR.txt $LIBR.iccf.column 2>/dev/null\n# rm $1 # removes the target file...\n# mv $1 ../../$1 # instead, moves the target file to ../../$1\n# mv $1 ../../$1"_"$(date +%Y-%m-%d) # most severe, moves the target file to ../../$1\n} # Test:\n#\n#* function camd - Check and manuipulate days\nfunction camd()\n{\n# if [ $($1 +%u) -ne "1" ]; then\n# echo $(date --date=$1 +%u)\nif [ $(date --date=$DATE +%u) -eq "1" ]; then\n echo "I suppose it is Monday";\n bin/2stap.sh $DATE # do today, Monday\n DATE=$(date --date=$DATE"-3day" +%m/%d/%Y ) # do Friday\n else\n echo "it is not Monday";\n fi # test for Mondayness...\n} # end of cass- monday-monday\n#\n#* function fwatch - Watches the end of a file indefinitely\nfunction fwatch(){\necho $#" "$var2" "$ARGS\n watch tail -20 $var2\n} # Test: vbtp2.sh fwatch var/log/messages\n#\n#* This downloads single files as in the listing\nfunction get(){\necho "The file we are downloading from " $LIB" is: "$FILE\ncurl -s ftp://$uid:$passwd@159.105.80.225//ADP/DWN/ICCF/$LIB/$FILE -o $FILE".iccf."$LIB".txt"\n} # Test: vbtp2.sh get\n#\n#* function cleanup - cleanup function deletes all temporary files\nfunction cleanup(){\necho "This is the cleanup function"\necho $#" "$ARGS\n#* Clean up stuff used in this function\n#* Remove buffers\nrm iccf.first.half iccf.second.half iccflist$LIBR.txt $LIBR.iccf.column 2>/dev/null\n# rm $1 # removes the bin/vbtp2.sh wait "..go on" 5target file...\n# mv $1 ../../$1 # instead, moves the target file to ../../$1\n# mv $1 ../../$1"_"$(date +%Y-%m-%d) # most severe, moves the target file to ../../$1\n} # Test:\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\necho "vbtp2.sh v 0.2 starts"\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n# ARGS=$# # carries the number of args into the functions...\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "pause" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "pause" ]; then ARGS="5"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "pause" ]; then ARGS="6"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "fwatch" ]; then ARGS="2"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "get" ]; then ARGS="6"; fi\nif [ "$#" -eq "4" ] && [ "$1" = "dir" ]; then ARGS="4"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "dir" ]; then ARGS="3"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "dir" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dir" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "tlog" ]; then ARGS="9"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "cleanup" ]; then ARGS="9"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "listful" ]; then ARGS="9"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "wait" ]; then ARGS="6"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#debug echo $#" "$1" "$2" "$3" "$ARGS #debug\n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; cat $0 | grep '^## ' | sed -e 's/##//'; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") clear; echo $ARGS" Your function here" ;; # Spare for capacity\n "8") clear; echo $ARGS" Your function here" ;; # Spare for capacity\n "9") clear; echo $ARGS" Your function here" ;; # Spare for capacity\n *) clear; help; exit 1;; # Anything else run help and exit...\nesac # End main loop. To TEST:\n#\n# echo " ";\necho "vbtp2.sh stops"\n# That's all folks!!\n# Junk shop\n# if [ "$#" -eq "3" ] && [ "$1" = "get" ] && [ "$2" = "all" ]; then ARGS="7"; fi\n# "2") secs=$2; while read line ; do $1; done;; # read from a file and process\n# *) clear; cat $0 | grep '^## ' | sed -e 's/##//'; exit 1;;\n#* restore environment\ncd $S\n\n}}}
Environment generator for python...\n{{{\n#!/bin/bash\n# pflint Tue 19 Feb 2013 07:46:49 AM EST \n# python debug environment\n#\n# check for prerequisits\n# for line in ipython banana screen \nfor line in ipython screen ; \ndo \n if [ -z $(which $line) ]; then \n echo "The $line is missing"; \n fi;\ndone\n# \n# Make sure only root can run our script\nsudo pwd\ncd /home/flint/rr\npwd\n#\nread -d '' String <<"EOF"\n# $Id: screenrc,v 1.15 2003/10/08 11:39:03 zal Exp $\n# pflint note this is merely a variable in the program py.sh\n#\n# /etc/screenrc\n#\n# This is the flint screenrc.\n#\n# You can use this file to change the default behavior of screen system wide\n# or copy it to ~/.screenrc and use it as a starting point for your own\n# settings.\n#\n# Commands in this file are used to set options, bind screen functions to\n# keys, redefine terminal capabilities, and to automatically establish one or\n# more windows at the beginning of your screen session.\n#\n# This is not a comprehensive list of options, look at the screen manual for\n# details on everything that you can put in this file.\n#\n\n# ------------------------------------------------------------------------------\n# SCREEN SETTINGS\n# ------------------------------------------------------------------------------\n\n#startup_message off\n#nethack on\n\n#defflow on # will force screen to process ^S/^Q\ndeflogin on\n#autodetach off\n\n# turn visual bell on\nvbell on\nvbell_msg " Wuff ---- Wuff!! "\n\n# define a bigger scrollback, default is 100 lines\ndefscrollback 1024\n\n# ------------------------------------------------------------------------------\n# SCREEN KEYBINDINGS\n# ------------------------------------------------------------------------------\n\n# Remove some stupid / dangerous key bindings\nbind ^k\n#bind L\n# bind ^\s # very tricky...\n# Make them better\nbind \s\s quit\nbind K kill\nbind I login on\nbind O login off\nbind } history\n\n# An example of a "screen scraper" which will launch urlview on the current\n# screen window\n#\n#bind ^B eval "hardcopy_append off" "hardcopy -h $HOME/.screen-urlview" "screen urlview $HOME/.screen-urlview"\n\n# ------------------------------------------------------------------------------\n# TERMINAL SETTINGS\n# ------------------------------------------------------------------------------\n\n# The vt100 description does not mention "dl". *sigh*\ntermcapinfo vt100 dl=5\sE[M\n\n# turn sending of screen messages to hardstatus off\nhardstatus off\n# Set the hardstatus prop on gui terms to set the titlebar/icon title\ntermcapinfo xterm*|rxvt*|kterm*|Eterm* hs:ts=\sE]0;:fs=\s007:ds=\sE]0;\s007\n# use this for the hard status string\nhardstatus string "%h%? users: %u%?"\n\n# An alternative hardstatus to display a bar at the bottom listing the\n# windownames and highlighting the current windowname in blue. (This is only\n# enabled if there is no hardstatus setting for your terminal)\n#\n#hardstatus lastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"\n\n# set these terminals up to be 'optimal' instead of vt100\ntermcapinfo xterm*|linux*|rxvt*|Eterm* OP\n\n# Change the xterm initialization string from is2=\sE[!p\sE[?3;4l\sE[4l\sE>\n# (This fixes the "Aborted because of window size change" konsole symptoms found\n# in bug #134198)\ntermcapinfo xterm 'is=\sE[r\sE[m\sE[2J\sE[H\sE[?7h\sE[?1;4;6l'\n\n# To get screen to add lines to xterm's scrollback buffer, uncomment the\n# following termcapinfo line which tells xterm to use the normal screen buffer\n# (which has scrollback), not the alternate screen buffer.\n#\n#termcapinfo xterm|xterms|xs|rxvt ti@:te@\n\n# ------------------------------------------------------------------------------\n# STARTUP SCREENS\n# ------------------------------------------------------------------------------\n\n# Example of automatically running some programs in windows on screen startup.\n#\n# The following will open top in the first window, an ssh session to monkey\n# in the next window, and then open mutt and tail in windows 8 and 9\n# respectively.\n#\n# screen top\n# screen -t monkey ssh monkey\n# screen -t mail 8 mutt\n# screen -t daemon 9 tail -f /var/log/daemon.log\n#\n# pflint \n# Thu Feb 9 23:24:52 EST 2006\n# added so pine will live...\nbindkey -k k; stuff ";a"\nbindkey -k F1 stuff "as"\n# bindkey -k F2 stuff ";cn"\n# the new spam key...\nbindkey -k F3 stuff "d"\n# new version key...\nbindkey -k F9 stuff "obe/$(date +%F)_"\nbindkey -k F2 stuff "obe/$(date +%F)_"\n# \n# Sat Mar 4 22:25:07 EST 2006\n#\n# screen top\n# screen -t monkey ssh monkey\nscreen -t python 1 python\nscreen -t ipython 2 ipython\nscreen -t test3 3\nscreen -t test4 4\nscreen -t test5 5\n# screen -t itemp 2 watch 'echo $(date +%s);head -20 /var/www/itemp/itemp.log'\n# screen -t otemp 3 watch 'echo $(date +%s);head -20 /var/www/otemp/otemp.log'\n# screen -t itemp 4 watch 'tail -20 /var/www/itemp/logs/itemp.log'\n# screen -t otemp 5 watch 'tail -20 /var/www/otemp/logs/otemp.log'\n# screen -t itemp.data 4 watch 'echo $(date +%F);echo $(date +%s); tail -20 /var/www/itemp/itemp.data'\n# screen -t otemp.data 5 watch 'echo $(date +%F);echo $(date +%s); tail -20 /var/www/otemp/otemp.data'\n# screen -t itemp.log 6 watch "echo $(date +%F);echo $(date +%s); tail -20 /var/www/itemp/logs/itemp.log"\n# screen -t otemp.log 7 watch "echo $(date +%F);echo $(date +%s); tail -20 /var/www/otemp/logs/otemp.log"\n# screen -t temp.log 8 watch "echo $(date +%F);echo $(date +%s); tail -20 /var/www/temp.log"\n# screen 9 # 'gedit /var/www/bin/mtsp.sh &'\n# screen -t mail 8 pine\n# screen -t daemon 9 tail -f /var/log/daemon.log\n#\n# pflint note this is merely a variable in the program py.sh\nEOF\n# echo "$String"\n# ref http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html\n# if [ ! -a ~/.screenrc ] ; then \nif [ ! -a "~/.screenrc" ] ; then \n echo "The .screenrc file was not there, there's one now..."; \nelse \n mv .screenrc obe/$(date +%F)_screenrc\nfi\necho "$String" > ~/.screenrc\nchmod 777 ~/.screenrc\n# exit 1\ncd ~/rr\nsudo screen\n\n}}}
Type the text for 'New Tiddler'
The script [[tiddlett|http://docbox.flint.com:8081/geekland#tiddlett]] is an early contributor to the framework concept. Tiddlet2 will use the ./.mozilla/firefox/mwad0hks.default/sessionstore.js\nfile to create the tiddle table...\n\nIn addition we will try to use the json command line tools mentioned by [[Jeroen Janssens here|http://jeroenjanssens.com/2013/09/19/seven-command-line-tools-for-data-science.html]]\n\nThe tool we are adding is [["jq"|http://stedolan.github.io/jq/download/]] a stand alone c based JSON parser.\n\n{{{\njq . ~/.mozilla/firefox/mwad0hks.default/sessionstore.js | grep -A5 docIdentifier | sed -e 's/^[ \st]*//'| grep -v "^}" |less -NS\n}}}\n\n{{{\njq . ~/.mozilla/firefox/mwad0hks.default/sessionstore.js | grep -A5 docIdentifier | sed -e 's/^[ \st]*//'| grep -v "^}" |grep docshellID | cut -d ":" -f 2 | sort -h | uniq -c |less \n}}}\n
This is a recent and simple example of a visual bash script.\n{{{\n#!/bin/bash\n# pflint Wed 29 Jan 2014 09:29:41 AM EST \n# \nversion="1.7"\n#\n# hold environment\nexport S=$PWD\n#* move to the appropriate directorygrep '^\s#\s*' pine.sh\n# cd ??\n#\n#* check location of vital files and programs, sanity check\n#* check location of vital files and programs, sanity check\nfor prog in curl gawk banana\ndo\n# echo $prog\nisit=$(which $prog)\necho $isit\nif [ ! -f "$isit" ]\nthen\n echo "the file $prog is not on system"\n exit 0\nfi\ndone\n# runs ballisticly\n#\n# Define files to be used\n# \n# qualify user\n# uid="" ; if [ "$uid" == "" ]; then echo "Set user id!"; exit; fi\n# passwd="" ; if [ "$passwd" == "" ]; then echo "Set user passwd!"; exit; fi\n# ??\n# uroot\n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug \ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is pine.sh, just a simple gizmo to get around.\n## The difficulty of having the dove imap daemon and pine fight. \n## This is released under GPL I\n## The syntax is:\n## - pine.sh status - Lets you know the status of dovecot imapd\n## - pine.sh off - Turns on imapd makes pine intermittent, \n## - pine.sh on - Allows pine to function, turns off imapd\n## in all of these, Output is delivered to the screen...\n## *** NOTE *** This program must be run as root!\n##\n## For structure information type "grep '^\s#\s*' pine.sh"\n## :^)\n## (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n##\n# *****Documentation Loop ends here the rest is function******\n#\n} # Test: pine.sh\n#\n#* function dummy - Rename and fill stuff in between braces\nfunction dummy(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test:\n#\n#* function status - Gives a status indication of the current status...\nfunction status(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nsudo /etc/init.d/dovecot status\n} # Test: ~flint/bin/pine.sh status \n#\n#* function use - shuts down dovecot starts pine and then starts up dovecot\nfunction use(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# starts pine w/o dovecot\nsudo /etc/init.d/dovecot stop\npine\n# alpine\nsudo /etc/init.d/dovecot start\nuroot\n} # Test:\n#\n#* function off - turns off imapd, and starts up pine...\nfunction off(){\n# uroot\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\necho "This stops dovecot"\nsudo /etc/init.d/dovecot stop\n# alpine\n} # Test: pine.sh off\n#\n#* function on - on allows pine to function, turns off imapd\nfunction on(){\n# uroot\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\necho "This starts dovecot"\nsudo /etc/init.d/dovecot start\n} # Test:~flint/bin/pine.sh on\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# Make sure only root can run our script\nif [ "$(id -u)" != "0" ]; then\n echo "This script must be run as root" 1>&2\n exit 1\nfi\n} # Test:~flint/bin/pine.sh uroot\n#\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n# echo "pine.sh v"$version" starts"\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n# ARGS=$# # carries the number of args into the functions...\nif [ "$#" -eq "1" ] && [ "$1" = "status" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "use" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "off" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "on" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#debug echo $#" "$1" "$2" "$3" "$ARGS \n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; cat $0 | grep '^## ' | sed -e 's/##//'; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") defvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. To TEST:\n#\n# echo " ";\necho "On "$(date +%F) $0" version "$version" stops"\n# That's all folks!!\n#\n#* restore environment\ncd $S\n\n}}}
The author of this page is flint@flint.com.\n\nAll work here is released under the General Public License version I [[(GPL I)|http://www.gnu.org/licenses/gpl-1.0.html]]
{{{\n\n#\n## *****DOCUMENTATION*****\n## You get this documentation when you put in the wrong number of arguments, or call "help"\n##\n## pedit Project Management software \n## Released under GPLv3 \n## Developed by cpyarger <cpyarger@gmail.com>\n##\n##\n## This Program is used to: \n##\n## * Keep track of current projects within the ~/Projects Folder\n## * Simplify git usage for projects\n## * Allow For not keeping of projects\n## * .pedit folder within each Project's folder will contain all notes for project\n## * pedit notes will not be deleted \n## * pedit notes will all be timestamped\n## * This project will use the Visual Bash framework created by Paul Flint <flint@flint.com>\n## * allow for individual environments based on active project\n## * Run in screen\n##\n##\n##\n#\n#\nversion="1.0"\n#\n# hold environment\nexport S=$PWD\n#* move to the appropriate directory\n# cd ??\n#\n#* check location of vital files and programs, sanity check\n# ??\n#\n# Define files to be used\n# uid="" ; if [ "$uid" == "" ]; then echo "Set user id!"; exit; fi\n# passwd="" ; if [ "$passwd" == "" ]; then echo "Set user passwd!"; exit; fi\n# ??\n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is "$0" "$version\ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## The syntax is:\n## Output is delivered to the screen...\n## - pedit help Displays this help\n##\n# *****Documentation Loop ends here the rest is function******\n#\n} # Test: template.sh\n#\n#\n\n#* function dummy - Dummy basic function template. Rename and fill stuff in between braces\n## - pedit dummy tests the dummy function\nfunction dummy(){\necho "In $0 version $version this is the \s"$FUNCNAME\s" function"\n# echo "This is the dummy function"\n} # Test:\n\n#* function track - Tracks folder changes since last "save"\nfunction track(){\necho "In $0 version $version this is the \s"$FUNCNAME\s" function"\n# echo "This is the dummy function"\n} # Test:\n\n#* function save - update and commit changes to git repository\nfunction save(){\necho "In $0 version $version this is the \s"$FUNCNAME\s" function"\n# echo "This is the dummy function"\n} # Test:\n#* function mkp - Make Project function, Creates a project and basic files within the ~/Projects directory\nfunction mkp(){\n tld=/home/$USER/Projects\n pname=$var2\n pdir=$tld/$pname\n mkdir -pv $pdir\n mkdir -pv $pdir/.pedit\n mkdir -pv $pdir/.pedit/note\n mkdir -pv $pdir/bkp\n echo "Project $pname created at $(date +%s)" > $pdir/.pedit/note/init\n echo "Created folder $pdir/.pedit" >>$pdir/.pedit/note/init\n echo "Created folder $pdir/.pedit/note" >>$pdir/.pedit/note/init\n echo "Created folder $pdir/bkp" >> $pdir/.pedit/note/init\n echo "Created project at location $pdir" >> $pdir/.pedit/note/init\n cat $pdir/.pedit/note/init\nreturn 0\n# echo "This is the dummy function"\n} # Test:\n\n#* function shell - loads environment and commands for selected project\n\nfunction shell(){\nfile=$0\nnum=$( grep -n "\s#* Evaluator Routine" $file |cut -d : -f 1 |tail -n 1)\necho "This is the shell function"\nhead -$num $file >/tmp/pedit\necho $0 help >>/tmp/pedit\necho 'PS1="\s[\se]0;\su@\sh: \sw\sa\s]${debian_chroot:+($debian_chroot)}pedit:\sw\s$ "'>>/tmp/pedit\n\nbash --rcfile /tmp/pedit\necho $num\n\necho $file\n\ncat /tmp/pedit\n} # Test:\n#* function struct - Print structure of file\n## - pedit struct displays program structure\nfunction struct(){\ngrep -C '^\s#\s*' $0\n# echo "This is the dummy function"\n} # Test:\n#\n#\n#\n#* function bkp - Backup function, backs up named file\n## - pedit bkp - Backs up current file to bkp/timestamp.filename \nfunction bkp(){\nbkptime=$(date +%s)\nbkpfile=bkp/$bkptime.$var2\ncp $var2 $bkpfile\necho "File $var2 backed up to $bkpfile"\n# echo "This is the dummy function"\n} # Test:\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n#echo "$0 v $version starts"\n#* Evaluator Routine\n#exy\n# Note the evaluator allows for many cases and error checking...\n# ARGS=$# # carries the number of args into the functions...\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "struct" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "shell" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "bkp" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "mkp" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#debug echo $#" "$1" "$2" "$3" "$ARGS #debug\n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; cat $0 | grep '^## ' | sed -e 's/##//'; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") clear; echo $ARGS" Your function here" ;; # Spare for capacity\n "8") clear; echo $ARGS" Your function here" ;; # Spare for capacity\n "9") clear; echo $ARGS" Your function here" ;; # Spare for capacity\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. To TEST:\n#\n# echo " ";\n#echo "$0 stops"\n# That's all folks!!\n# Junk shop\n# if [ "$#" -eq "3" ] && [ "$1" = "get" ] && [ "$2" = "all" ]; then ARGS="7"; fi\n# "2") secs=$2; while read line ; do $1; done;; # read from a file and process\n# *) clear; cat $0 | grep '^## ' | sed -e 's/##//'; exit 1;;\n#* restore environment\n#cd $S\n\n\n\n}}}
\n\n[[StackScripts|https://library.linode.com/stackscripts]] are a very useful concept and might be a building block for visual bash.\n\nWhat we need to see is [[ssinclude]]\n\nssinclude is a bit elusive, here is a [[sample|https://gist.github.com/steakknife/3451960]]
[[Strembot movie 2014-03-21|https://plus.google.com/photos/113799284948875539893/albums/5993255884804250945/5993255887182865154?pid=5993255887182865154&oid=113799284948875539893]]
Could a framework be developed that would allow for extensive use of bash as a general purpose information management system?\n\nIf you don't have a GUI in this day and age you are lost...\n* The program QBASIC had a framework that allowed you to access individual subroutines the big ticket was the editor essentially the first Integrated Development Environment.\n* Visual Basic and it's successors all seem to all be based upon the idea of an IDE.\n* This is carried over even as far as the [[Arduino Sketch|https://en.wikipedia.org/wiki/Arduino#Software]]\n\nWhy not build a framework around BASH?\n* The first step is [[shell qualifiers|ShellQualifiers]], all these are subject to change.\n* Keep in mind the "GUI" could and should be the method of choice, sketch, whiptail, emacs...\n* Visual Bash will be using [[bzinga|http://bzinga.net]] as a graphic tool for the time being.\n\nExamples include:\n* [[template.sh|template.sh]]\n* [[age.sh|age.sh]]\n* [[pine.sh|pine.sh]]\n\nExtend this idea with [[Graphic Secure Dispatch|GraphicalSecureDispatch]], soon to be renamed [[tropes|http://en.wiktionary.org/wiki/trope#English]] a computer language that needs to be written.\n\nNote that [[loading everything into a variable|http://docbox.flint.com:8081/geekland#HereDocument]] also works.\nPay attention to the wisdom of [[Robert Muth|http://robertmuth.blogspot.in/2012/08/better-bash-scripting-in-15-minutes.html]] this will be incorporated into \nthe new template examples...\n\nRandom bits of [[Visual Bash News|VisualBashNews]]
{{{\n#!/bin/bash\n# pflint Tue 24 Jun 2014 06:59:14 AM EDT \n# \nversion="1.0"\n#\n# hold environment\nexport S=$PWD\n#* move to the appropriate directory\n# cd ??\n#* check location of vital files and programs, sanity check\nfor prog in curl gawk \ndo\n#debug echo $prog\nisit=$(which $prog)\n#debug echo $isit\nif [ ! -f "$isit" ]\nthen\n echo "the file $prog is not on system"\n exit 0\nfi\ndone\n# runs ballisticly\n#\n# Define files to be tested\n# ??\n# \n# qualify user, who must be root.\n# uid="" ; if [ "$uid" == "" ]; then echo "Set test1r id!"; exit; fi\n# passwd="" ; if [ "$passwd" == "" ]; then echo "Set user passwd!"; exit; fi\n# ??\n# uroot\n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug \ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is aspera.sh, a gizmo in response to a test.\n## The difficulty of having the dove imap daemon and pine fight. \n## This is released under GPL I\n## The syntax is:\n## - aspera.sh <check, install, remove > \n## - Checks for Aspera Connect, if necessary downloads \n## and installs.\n## - aspera.sh test1 - downloads json file, compares it to local time\n## prints results. Output delivered to screen...\n## - aspera.sh test2 <logfile> (supports "default" as "aspera.log")\n## - Outputs report delivered to screen. \n## - aspera.sh test3 <source file> <destination file> \n## copies source to destination\n## MD5 Sum is delivered to the screen... \n##\n## For structure information type "grep '^\s#\s*' aspera.sh"\n## :^)\n## (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n##\n# *****Documentation Loop ends here the rest is function******\n#\n} # Test: aspera.sh\n#\n#* function dummy - Rename and fill stuff in between braces\nfunction dummy(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test:\n#\n#* function down1 - gets file makes comparison to local time.\nfunction down1(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# ok so you could do it in javascript, but for three variables why bother?\n#\n# wget http://time.jsontest.com/index.html; mv index.html time.jsontest.com\ncurl http://time.jsontest.com/index.html > time.jsontest.com\nls -alt | grep jsontest\n} # Test: aspera.sh down1\n#\n#* function test1 - gets file makes comparison to local time.\nfunction test1(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# ok so you could do it in javascript, but for three variables why bother?\n#\nclear\necho "Note this is a first approximation and has not been reviewed for accuracy"\necho "downloading http://time.jsontest.com/index.html"\ndown1 2>/dev/null\nepok=$(date +%s)\ndday=$(date +%m-%d-%Y)\ntyme=$(date +'%H:%M:%S %p')\necho "...just after this download, time data we have is:"\necho -e "EPOCH \st\st DAY \st\st TIME "\necho -e $epok "\st" $dday "\st" $tyme "\st -from downloaded file"\nmsin=$(cat time.jsontest.com | grep epoch | cut -d ":" -f2 | tr -d [:space:] |tr -d ",")\nepik=$(($msin / 1000))\ntimi=$(cat time.jsontest.com | grep time | cut -d "\s"" -f4)\nddiy=$(cat time.jsontest.com | grep date | cut -d "\s"" -f4)\necho -e $epik "\st" $ddiy "\st" $timi "\st -from system time"\necho -e "__________ \st __________ \st __________ "\neimi=$(date -ud "$timi" +%s);# echo $eimi\neyme=$(date -ud "$tyme" +%s);# echo $eyme\n# echo -e "straight "${timi:0:8} "\st" ${tyme:0:8}\n# echo -e "epoch "$eimi "\st" $eyme\ntout=$(( $eimi - $eyme )) \n# echo $tout\ndins=$(date -u -d @"$tout" +'%H:%-M:%-S')\neday=$(date -d$(echo "$dday" |tr "-" "/") +%s) \nediy=$(date -d$(echo "$ddiy" |tr "-" "/") +%s) \neddy=$(( $eday - $ediy )) \nprintf "%010s" $(( $epok - $epik ))\n# echo -e "\st\st\st "$dins"\st -Difference"\necho -e "\st\st"$eddy"\st "$dins"\st -Difference"\necho ""\n# date -d$(echo $eddy) +%m/%d/%Y\n# Date with dash\n# date -d$(echo "06-25-2014" |tr "-" "/") +%m/%d/%Y\n# Milliseconds since epoch\n# date -d @$((1403727716959 / 1000)) +%m/%d/%Y\n# jdate=$(date -d @$((1403727716959 / 1000)) +%m/%d/%Y)\n# date --date="$jdate" +%s\n# time\n# SOURCE: http://www.vanstechelman.eu/linux/time-conversion-using-bash \n# date "+%s" -d "02/20/2013 08:41:15"\n} # Test: aspera.sh test1\n#\n#* function test2 - gets file writes report\nfunction test2(){\n# This script will report:\n# - Total number of ascp transfers;\n# - Listing of all transfers and their average rate in Mb/s;\n# - PID of transfer(s) with the longest duration;\n# - PID of the transfer(s) sending the most data;\n# - PID of the transfer(s) with the fastest rate.\n# Note this should be done with Splunk...\n#debug\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version \ntest "$var2" = "default" && var2="aspera.log"\n# debug\n# grep "ascp\s[" aspera.log | grep "status=success" | grep "Transfer" | wc -l\nttotal=$(grep "ascp\s[" $var2 | grep "status=success" | grep "Transfer" | wc -l)\n# grep "ascp\s[" aspera.log | grep "status=success" | grep "Transfer" |cut -d" " -f 14 | less -NS\necho "The total number of transfers in the file "$var2" is "$ttotal\ntot=$( grep "ascp\s[" $var2 | grep "status=success" | grep "Transfer" |cut -d" " -f 14 | cut -c 6-| less |gawk '{ sum += $1; n++ } END { if (n > 0) printf ("%d\sn",sum ) }') \navt=$( grep "ascp\s[" $var2 | grep "status=success" | grep "Transfer" |cut -d" " -f 14 | cut -c 6-| less |gawk '{ sum += $1; n++ } END { if (n > 0) printf ("%d\sn",sum / n ) }') \natr=$(grep "ascp\s[" $var2 | grep "status=success" | grep "Transfer" |cut -d" " -f 16 | cut -c 6-| sed 's/Kbps/0/g' |sed 's/Mbps/0000/g'|sed 's/Gbps/0000000/g' |sed 's/\s.//g' |gawk '{ sum += $1; n++ } END { if (n > 0) printf ("%d\sn",sum ) }')\ncat transfer_list.log |while read line; do tst=$(echo $line| cut -d" " -f 14| cut -c 6-); echo -e $tst"\st"$line; done > sort.tmp \nsort -n sort.tmp > sorted.tmp\nbgstl=$(tail -1 sorted.tmp |cut -d$'\st' -f2)\n# echo "HERE "$bgstl\nbs=$(echo $bgstl |cut -d" " -f14) ;sbs=${bs:5} \n# ascp=$(echo $bgstl |cut -d" " -f5);pid=$(echo ${ascp:5:4})\nascp=$(echo $bgstl |cut -d" " -f5);pid=$(echo ${ascp:5:(${#ascp}-7)})\n# ascp=$(echo $bgstl |cut -d" " -f5);pid=$(echo ${ascp:5:4:(${#ascp}-7)}})\n# cat transfer_list.log |while read line; do spd=$(echo $line| cut -d" " -f 16| cut -c 6-| sed 's/Kbps/0/g' |sed 's/Mbps/0000/g'|sed 's/Gbps/0000000/g' |sed 's/\s.//g'); echo -e $spd"\st"$line; done > sort.tmp; sort -n sort.tmp > tsort.tmp\n#\n# suppress leading zeros in sorted speed list...\ncat transfer_list.log |while read line; do spd=$(echo $line| cut -d" " -f 16| cut -c 6-| sed 's/Kbps/0/g' |sed 's/Mbps/0000/g'|sed 's/Gbps/0000000/g' |sed 's/\s.//g'); echo -e $spd"\st"$line; done > sort.tmp; cat sort.tmp | grep -v ^0000 |sort -n > tsort.tmp\nfs=$(tail -1 tsort.tmp |cut -d$'\st' -f1);fbs=${bs:5} \nfstt=$(tail -1 tsort.tmp |cut -d$'\st' -f1)\nfstl=$(tail -1 tsort.tmp |cut -d$'\st' -f2)\n\nfascp=$(echo $fstl |cut -d" " -f5);fpid=$(echo ${fascp:5:(${#fascp}-7)})\nprintf "The total number of bytes transfered is %'d\sn" $tot\nprintf "The average file size in bytes is %'d\sn" $avt \nprintf "The average transfer rate in bits per second is %'d\sn" $atr \nfnl=$(printf "handled biggest file, which contained %'d\sn" $sbs)\necho "The \s"ascp\s" process number $pid "$fnl" bytes"\nfnt=$(printf "had the fastest transfer rate, %'d\sn" $fstt )\necho "The \s"ascp\s" process number $fpid "$fnt" in bits per second"\n#\ngrep "ascp\s[" $var2 | grep "status=success" | grep "Transfer" > transfer_list.log\necho "To see the listing of all of transfers $ttotal in all now in transfer_list.log [Enter] key to continue hit any other key"\nread an \n# test $an = "" || less -NS transfer_list.log\nif [[ $an == "" ]]; then less -NS transfer_list.log; fi\n#\n# remove the temp files\nrm -rf *.tmp\n} # Test: aspera.sh test2 default\n#\n#* function test3 - Copies files using string function...\nfunction test3(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nrm -rf $var3 \ntouch $var3 \nwhile IFS= read -r line \ndo \n printf '%s\sn' "$line" >> $var3; \ndone < "$var2"; \nclear\necho "Performance Implications:";echo -e "\stThis is gonna be slow, but you have some serious control as it is a string"\necho " Methods to Compare to:";echo -e "\stOther copy methods are Andrew Trigell's rsync, cp, dd, and the like" \necho ""\necho "MD5 sums of "$var2" and "$var3\nmd5sum $var2\nmd5sum $var3\necho ""\necho "Be aware that this method has a bug when copying binary files, others are better."\n} # Test:\n#\n#* function check - Tests for & if necessary downloads Aspera Connect...\nfunction check(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nif [ -d ~/.aspera ]; then echo "Aspera is installed"; else echo "Aspera is not installed"; fi\n} # Test: ~flint/bin/aspera.sh check \n#\n#\n#* function remove - uninstalls aspera-connect-3.3.3.81344-linux-32.sh...\nfunction remove(){\nuroot\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# pflint Tue 24 Jun 2014 12:59:11 PM EDT \n# uninstalls Aspera Connect from Linux system.\nclear\necho "Uninstalling Aspera Connect ($HOME/.aspera) for the current user only."\nread -p "The program "$0" will uninstall Aspera from "$HOME" directory only. Press [Enter] key to continue <ctl> c to stop program..."\n# debug \nsudo rm -rf ~/.aspera \n# 2>/dev/null && echo "Unable to remove .aspera directory in $HOME. Aspera uninstall did not work" \n# echo $INSTALL_DIR/bin > $INSTALL_DIR/etc/asperaconnect.path\n# read -p $0" continues and will now uninstall Aspera the mozilla plugin directory "$HOME/.mozilla/plugins". Press [Enter] key to continue <ctl> c to stop program..."\n# Delete mozilla plug-in\n# debug\nrm -rf ~/.mozilla/plugins/libnpasperaweb.so || echo "Unable to remove files in "$HOME/.mozilla/plugins"." \nread -p $0" continues and will now try to delete the install files "$HOME/.mozilla/plugins". Press [Enter] key to continue <ctl> c to stop program..."\nls -1 | grep aspera-connect-3.3.3.81344-linux-32 \nls -1 | grep aspera-connect-3.3.3.81344-linux-32 |xargs rm -rf\necho "Restart firefox manually to clear the Aspera Connect plug-in"\necho "removal complete."\n} # Test: aspera.sh remove\n#\n#* function install - installs aspera software\nfunction install(){\n# uroot\nclear\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nwget http://d3gcli72yxqn2z.cloudfront.net/connect/bin/aspera-connect-3.3.3.81344-linux-32.tar.gz\ntar -zxvf aspera-connect-3.3.3.81344-linux-32.tar.gz\n./aspera-connect-3.3.3.81344-linux-32.sh\n\n} # Test:aspera.sh install\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# Make sure only root can run our script\nif [ "$(id -u)" != "0" ]; then\n echo "This script must be run as root" 1>&2\n exit 1\nfi\n} # Test:~flint/bin/aspera.sh uroot\n#\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n# echo "aspera.sh v"$version" starts"\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n# ARGS=$# # carries the number of args into the functions...\nif [ "$#" -eq "1" ] && [ "$1" = "test0" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "test1" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "test2" ]; then ARGS="2"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "test3" ]; then ARGS="3"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "down1" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "check" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "install" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "remove" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#debug read -p $#" "$1" "$2" "$3" "$ARGS \n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; cat $0 | grep '^## ' | sed -e 's/##//'; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") defvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. To TEST:\n#\n# echo " ";\necho "On "$(date +%F) $0" version "$version" stops"\n# That's all folks!!\n#\n#* restore environment\ncd $S\n}}}
''Information Dump''\n\n|!Reference HTML|! Description|\n|[[Google search for examples|https://www.google.com/search?client=ubuntu&channel=fs&q=shellshock+exploit+examples&ie=utf-8&oe=utf-8]]| Mildly useful|\n|[[Google Search |https://www.google.com/search?client=ubuntu&channel=fs&q=shellshock&ie=utf-8&oe=utf-8]]| Google search for shell shock|\n|[[Cnet|http://www.cnet.com/news/bigger-than-heartbleed-bash-bug-could-leave-it-systems-shellshocked/]]| Great Sensationalizim|\n|[[Twitter |https://twitter.com/hashtag/shellshock?src=hash]]| Twitter Traffil|\n|[[BBC |http://www.bbc.com/news/technology-29361794]]| Anutie Beeb Chimes In|\n|[[Wired |http://www.wired.com/2014/09/internet-braces-crazy-shellshock-worm/]]| Wired, are you kidding?|\n|[[Forbes |http://www.forbes.com/sites/jameslyne/2014/09/25/shellshocked-vulnerability-why-you-are-at-risk-and-heartbleed-3-0b/]]| Forbes? Wow...|\n|[[Akami |https://blogs.akamai.com/2014/09/environment-bashing.html]]| Akami takes it seriously|\n|[[ZDnet |http://www.zdnet.com/unixlinux-bash-critical-security-hole-uncovered-7000034021/]]| Blah blah...|\n|[[Splunk Dector |http://blogs.splunk.com/2014/09/24/finding-shellshock-cve-2014-6271-with-splunk-forwarders/]]| Do this.|\n|[[Splunk Dector |http://blogs.splunk.com/2014/09/24/finding-shellshock-cve-2014-6271-with-splunk-forwarders/]]| Splunk Shell Shock Detector|\n|[[Red Hat |https://securityblog.redhat.com/2014/09/24/bash-specially-crafted-environment-variables-code-injection-attack/]]| Explanation from Red Hat|\n\n\n\n\nWorking Detect Script\n{{{\n#!/bin/sh\n# 2014-09-25 10:35:11 pflint\n# SOURCE:http://blogs.splunk.com/2014/09/24/finding-shellshock-cve-2014-6271-with-splunk-forwarders/\n#\nHOSTNAME=$(/bin/hostname)\nRUNNING=$(/bin/date)\nTHECHECK=$(env='() { :;}; echo status=VULNERABLE' bash -c "ls -al /bin/bash" 2>&1 /dev/null)\nif [ "$THECHECK == *VULNERABLE*" ] ; then echo "$RUNNING hostname=$HOSTNAME cve=2014-6271 status=VULNERABLE"; else "$RUNNING hostname=$HOSTNAME cve=2014-6271 status=NOTVULNERABLE"; fi\n}}}\n\nOld version....\n{{{\n#!/bin/bash\n# 2014-09-25 10:35:11 pflint\n# SOURCE:http://blogs.splunk.com/2014/09/24/finding-shellshock-cve-2014-6271-with-splunk-forwarders/\n#\nHOSTNAME=$(/bin/hostname)\nRUNNING=$(/bin/date)\nTHECHECK=$(env='() { :;}; echo status=VULNERABLE' bash -c "ls -al /bin/bash" 2>&1 /dev/null)\nif [[ $THECHECK == *VULNERABLE* ]] ; then echo "$RUNNING hostname=$HOSTNAME cve=2014-6271 status=VULNERABLE"; fi\nif [[ $THECHECK != *VULNERABLE* ]] ; then echo "$RUNNING hostname=$HOSTNAME cve=2014-6271 status=NOTVULNERABLE"; fi\n}}}
This is what we are testing.\n\n{{{\n#!/bin/sh\n# 2014-09-25 10:35:11 pflint\n# SOURCE:http://blogs.splunk.com/2014/09/24/finding-shellshock-cve-2014-6271-with-splunk-forwarders/\n#\nHOSTNAME=$(/bin/hostname)\nRUNNING=$(/bin/date)\nTHECHECK=$(env='() { :;}; echo status=VULNERABLE' bash -c "ls -al /bin/bash" 2>&1 /dev/null) #echo $THECHECK\nif [ "$(echo $THECHECK |grep VUL)" ] ; then echo "$RUNNING hostname=$HOSTNAME cve=2014-6271 status=VULNERABLE"; else echo "$RUNNING hostname=$HOSTNAME cve=2014-6271 status=NOTVULNERABLE"; fi\n}}}\n\n\n
Testing results:\nCode:\n{{{\n#!/bin/bash\n# 2014-09-25 10:35:11 pflint\n# SOURCE:http://blogs.splunk.com/2014/09/24/finding-shellshock-cve-2014-6271-with-splunk-forwarders/\n#\nHOSTNAME=$(/bin/hostname)\nRUNNING=$(/bin/date)\nTHECHECK=$(env='() { :;}; echo status=VULNERABLE' bash -c "ls -al /bin/bash" 2>&1 /dev/null)\nif [[ $THECHECK == *VULNERABLE* ]] ; then echo "$RUNNING hostname=$HOSTNAME cve=2014-6271 status=VULNERABLE"; fi\nif [[ $THECHECK != *VULNERABLE* ]] ; then echo "$RUNNING hostname=$HOSTNAME cve=2014-6271 status=NOTVULNERABLE"; fi\n}}}\n\nOn unpatched box:\n{{{\n$ THECHECK=$(env='() { :;}; echo status=VULNERABLE' bash -c "ls -al /bin/bash" 2>&1 /dev/null); echo $THECHECK\nstatus=VULNERABLE -rwxr-xr-x 1 root root 818232 2010-04-18 21:51 /bin/bash\n}}}\n\nOn patched box:\n{{{\n$ THECHECK=$(env='() { :;}; echo status=VULNERABLE' bash -c "ls -al /bin/bash" 2>&1 /dev/null);echo $THECHECK\nbash: warning: env: ignoring function definition attempt bash: error importing function definition for `env' -rwxr-xr-x 1 root root 986672 Sep 22 16:40 /bin/bash\n}}}
{{{\n#!/bin/bash\n# pflint Mon 18 Nov 2014 10:58:26 AM EST\n# add checking...Mon 24 Nov 2014 10:24:46 AM EST \n# \n# the Old CD Game\nversion="0.2"\n#\n# next lines run ballisticly\n#* hold environment\nS=$PWD\n# echo "This is the path "$S\n#\n#* check location of vital files and programs, sanity check\nfor prog in curl gawk isoinfo hal-find-by-capability hal-find-by-property beep # debug banana\ndo\n# echo $prog\nisit=$(which $prog)\n# echo $isit \nif [ ! -f "$isit" ]\nthen\n echo "the file $prog is not on system"\n exit 0\nfi\ndone\n#\n# Define files to be used\n# \n# qualify user\n# uid="" ; if [ "$uid" == "" ]; then echo "Set user id!"; exit; fi\n# passwd="" ; if [ "$passwd" == "" ]; then echo "Set user passwd!"; exit; fi\n# echo "Check if you are root"\n# uroot()\n# exit\n#\n# above runs ballisticly\n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; uroot #debug \ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is ocdg.sh, just a simple gizmo to get around.\n## The difficulty of having the dove imap daemon and pine fight. \n## This is released under GPL I\n## The syntax is:\n## - ocdg.sh diriso - shows directory of iso files in current directory\n## - ocdg.sh makeiso - makes an iso copy of cd to current directory\n## - ocdg.sh prtcd <filename> - prints a CD DVD of <filename> \n## - ocdg.sh tst <filename.iso> - tests current CD/DVD \n## in all of these, Output is delivered to the screen...\n## *** NOTE *** This program must be run as root!\n##\n## For structure information type "grep '^\s#\s*' ocdg.sh"\n## :^)\n## (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n##\n# *****Documentation Loop ends here the rest is function******\n#\n} # Test: ocdg.sh\n#\n#* function dummy - Rename and fill stuff in between braces\nfunction dummy(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test:\n#\n#* function diriso - shows all the iso files in the current directory\nfunction diriso(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nls | grep iso |xargs ls\n} # Test:\n#\n#* function status - Gives a status indication of the current status...\nfunction makeiso(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nclear; echo "this is version "$version\nname=$(isoinfo -d -i /dev/cdrom | grep -i "volume id" | cut -d ":" -f 2 | tr -d " ")\nblock=$(isoinfo -d -i /dev/cdrom | grep -i "block size" | cut -d ":" -f 2 | tr -d " ")\nSTART=$(date +%s)\necho "Name of this DVD "$name" and the block size is "$block\n# do something\n# start your script work here\nspause\necho "begin to copy with cat the file "$PWD$"/"name.iso; cat /dev/cdrom > ./$name.iso\n# your function ends here\nEND=$(date +%s)\nDIFF=$(( $END - $START ))\necho "It took $DIFF seconds"\neject /dev/cdrom\n} # Test: ~flint/bin/ocdg.sh makeiso \n#\n#* function tst - tests if CD burned ok.\nfunction tst(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nlpdir=${var2/.iso/}\necho "This step mounts "$var2" as subdirectory "$lpdir" and copies the directory to the file dskd"\n# lvd=$(du -h --max-depth=1 $lpdir |tr -d $lpdir |md5sum|rev | cut -c 3- |rev) \nmkdir $lpdir; mount -o loop $var2 $lpdir # >/dev/null\ncd $lpdir; du -h --max-depth=1 > ../dskdir; cd ..\n# cd $lpdir\necho "This step mounts the dvd as subdirectory dvd and copies the directory to the file dvddir"\necho "put the "$var2" cd in to test"\nisoinfo -d -i /dev/cdrom\nspause\n# mkdir dvd; mount /dev/dvd dvd\nmkdir dvd; mount /dev/cdrom dvd\ncd dvd; du -h --max-depth=1 > ../dvddir; cd ..\necho "This step calculates the checksum"\nclear\n$(diff dskdir dvddir >/dev/null) || echo "something broke"\n$(diff dskdir dvddir >/dev/null) && echo "Copy compares OK"\n# spause\necho "unmount and clean up"\numount $lpdir ;rm -rf $lpdir\numount "dvd" ;rm -rf "dvd"\nrm -rf dvd $lpdir\neject /dev/cdrom\n} # Test:ocdg.sh tst <filename.iso>\n#\n#* function off - turns off imapd, and starts up pine...\nfunction prtcd(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\necho "The file name you picked is "$var2\nif [ ! -f "$var2" ]; then \n echo "The File \s"$var2\s" Does Not Exist nothing can happen"\n return \nfi \necho "The File $var2 Exists"\necho -n "Put a blank CD in and "\nUDI=`hal-find-by-capability --capability storage.cdrom`\ndevice=`hal-get-property --udi $UDI --key block.device`\necho $device\necho "Put a nice shiny new dvd in with at least "$(ls -alt $var2 | cut -d " " -f 5)" of capacity"\nspause\nwodim dev=$device -v -data $var2\necho "all done. Write "$var2" on the disk with the sharpie proviced"\neject $device\nplay /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga 2>/dev/null\n} # Test: ocdg.sh tst <filename.iso>\n# Fri 21 Nov 2014 09:49:12 AM EST NOTES ON OVERSIZE ISO IMAGES:\n# http://gotoanswer.stanford.edu/error_while_burning_dvd_help-4325359/\n# \n# ubuntu autolaunch "you have just inserted"\n# gnome-control-center &\n# applications > media\n# http://askubuntu.com/questions/6677/how-do-i-banish-the-you-have-just-inserted-an-audio-cd-dialog-forever\n# \n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script must be run as root, restart as root user" 1>&2\n exit 1\nfi\n} # Test:~flint/bin/ocdg.sh uroot\n#\n######################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n# echo "ocdg.sh v"$version" starts"\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n# ARGS=$# # carries the number of args into the functions...\nif [ "$#" -eq "1" ] && [ "$1" = "makeiso" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "diriso" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "prtcd" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "tst" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "on" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#debug echo $#" "$1" "$2" "$3" "$ARGS \n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; $1="help"; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") defvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. To TEST:\n#\n# echo " ";\necho "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug echo "That's all folks!!"\n#\n#* restore environment\ncd "$S"\n}}}\n
{{{\n#!/bin/bash\n# pflint Fri 30 Jan 2015 04:04:36 PM EST \n# setup bug worked \n# \n# Grant Generator\nversion="0.09"\n#\n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; uroot #debug \ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is chello.sh, a tiddle based proposal generator.\n## This is released under GPL I\n## The syntax is:\n## - chello.sh sett <Tiddle URL> <UID> <PASS> - \n## sets the name of the tiddlewiki you want to work on \n## - chello.sh showt - shows the name of the \n## tiddlewiki you are currently working on \n## - chello.sh maket <PROJNAME> - makes a <PROJNAME> \n## - chello.sh remt <PROJNAME> - removes a <PROJNAME>\n## - chello.sh settt <TITLE> - sets title in tiddle \n## - chello.sh setst <STITLE> - sets sub-title in tiddle\n## - chello.sh overview - generates and overview, sets it as default\n## - chello.sh dlt - downloads relevant tiddles\n## - chello.sh dtp - downloads default tiddler\n## in all of these, Output is delivered to the screen...\n## *** NOTE *** This program need not be run as root!\n##\n## For structure information type "grep '^\s#\s*' chello.sh"\n## :^)\n## (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n##\n# *****Documentation Loop ends here the rest is function******\n#\n} # Test: chello.sh\n# next lines run ballisticly\n#* hold environment\nS=$PWD\n# echo "This is the path "$S\n# debug\n#\n# Define files to be used\n#* function ch4ps - checks and reports on what you need.\nfunction ch4ps(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n#* check location of vital files and programs, sanity check\nrm -rf need > /dev/null\nfor prog in curl expect cadaver xmlstarlet git # debug banana\ndo\n # echo $prog\n isit=$(which $prog)\n # echo $isit \n if [ ! -f "$isit" ];\n then\n echo $prog >> need\n #debug echo "Type \s"sudo apt-get install $prog\s" to fix this."\n #debug spause\n # exit 0\n fi\ndone\nclear\necho "Welcome to $0!"\necho "Missing programs:"\n if [ -f need ];\n then\n echo " This program needs the following program(s) to be installed on this system."\n cat need |while read line; do echo -e \s\st" - " $line; done\n echo " If you want them installed please logon as root (sudo $0) and they will install"\n exit 0 # breaks you out of loop...\n fi\n#\necho "end of check"\n} # Test:\n#\n#\n#* function instg - # installs extra software if you are root, installs all the good stuff\nfunction instg(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nif [ "$(id -u)" = "0" ] && [ -f need ]; then\n echo "You are root and you are about to install the following:" 1>&2\n cat need |while read line; do echo -e \s\st" - " $line; done\n read -p "Hit enter to continue and install..." an\n #debug\n cat need |while read line; do apt-get install $line; done\n #debug cat need |while read line; do echo -e \s\st" - " $line; done\nfi\nrm -rf need\n#debug exit 0 # breaks you out of loop...\n} # Test:\n# \n# qualify user\n# uid="" ; if [ "$uid" == "" ]; then echo "Set user id!"; exit; fi\n# passwd="" ; if [ "$passwd" == "" ]; then echo "Set user passwd!"; exit; fi\n# echo "Check if you are root"\n# uroot()\n# exit\n#\n# next lines run ballisticly\n#debug \ninstg # installs extra software if you are root\nch4ps # checks and reports on what you need.\n# above runs ballisticly\n#\n#* function dummy - Rename and fill stuff in between braces\nfunction dummy(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test:\n#\n#\n#* function sett - sets the name and logon for tiddlewiki you want to work on\nfunction sett(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nrm -rf ss\ntiddleurl=$var2;uid=$var3;pass=$var4\n#\necho -e " TiddleURL is\st"$tiddleurl \necho -e " UID is \st"$uid\necho -e " PASS is \st"$pass\n#\ntouch ss\necho $tiddleurl >> ss\necho $uid >> ss\necho $pass >> ss\n#\nspause\n} # Test: ./chello.sh sett one two three\n#\n#\n#* function showt - shows the name for tiddlewiki you are currently working on\nfunction showt(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nIFS=$'\sn' ss=($(cat ss))\n# [[ ${ss[1]} = $name ]] && echo "${a[$i]}"\ntiddleurl=${ss[0]};\nuid=${ss[1]};\npass=${ss[2]}\nproj=${ss[3]}\n#\necho -e " TiddleURL is\st"$tiddleurl \necho -e " UID is \st"$uid\necho -e " PASS is \st"$pass\necho -e " PROJECT is \st"$proj\n#\n#debug spause\n} # Test: ./chello.sh showt\n#\n#* function maket <PROJNAME> - makes a <PROJNAME> in the current tiddlewiki\nfunction maket(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\nshowt > /dev/null\n#debug spause\n# packs expect and sends it out...\n# \n# From this line to EOF is the code to export\n# note slash escapes (\s\s)\nread -d '' String <<"EOF"\n#!/usr/bin/expect -f\nset tiddleurl [lindex $argv 0]\nset user [lindex $argv 1]\nset pass [lindex $argv 2]\nset proj [lindex $argv 3]\n# puts "Argument data:\sn";\n# puts "user: $user";\n# puts "pass: $pass";\n# puts "proj: $proj";\n# puts "tiddleurl: $tiddleurl";\n# check...\nif { $user == "" || $pass == "" || $tiddleurl == "" || $proj == "" } {\n puts "Usage: <user> <pass> <tiddleurl> <proj> n"\n exit 1\n}\nspawn /usr/bin/cadaver http://$tiddleurl/\nexpect "Username:"\nsend "$user\s\sn"\nexpect "Password:"\nsend "$pass\s\sn"\nexpect "dav:"\nsend "copy ZiddlyWiki $proj\s\sn"\nexpect "dav:"\nsend "quit\s\sn"\nEOF\necho "this is the project "$var2\necho $var2 >> ss\necho "$String" > doit.exp\nchmod +x doit.exp\n# debug \n./doit.exp $tiddleurl $uid $pass $var2 | grep succeeded\n#debug > /dev/null\nrm -rf doit.exp\n#\n} # Test: ./chello.sh maket banana\n#\n#* function remt <PROJNAME> - removes a <PROJNAME> in the current tiddlewiki\nfunction remt(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\nshowt > /dev/null\n#debug spause\n# packs expect and sends it out...\n# \n# From this line to EOF is the code to export\n# note slash escapes (\s\s)\nread -d '' String <<"EOF"\n#!/usr/bin/expect -f\nset tiddleurl [lindex $argv 0]\nset user [lindex $argv 1]\nset pass [lindex $argv 2]\nset proj [lindex $argv 3]\nspawn /usr/bin/cadaver http://$tiddleurl/\nexpect "Username:"\nsend "$user\s\sn"\nexpect "Password:"\nsend "$pass\s\sn"\nexpect "dav:"\nsend "rmcol $proj\s\sn"\nexpect "dav:"\nsend "quit\s\sn"\nEOF\n# echo "this is the project "$var2\necho "$String" > doit.exp\nchmod +x doit.exp\n# debug \n./doit.exp $tiddleurl $uid $pass $var2 | grep succeeded\n#debug > /dev/null\n#debug \n#debug \nrm -rf doit.exp\n#\n# remove the project name from secret squirrel fle\n\n} # Test:\n#\n#\n#* function settt - sets the name of the title tiddle \nfunction settt(){\n# curl -T banana.title http://the:end@docbox.flint.com:1980/banana/tiddlers/SiteTitle\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nshowt > /dev/null\necho $var2 > proj.title\ncurl -T proj.title http://$uid:$pass@$tiddleurl/$proj/tiddlers/SiteTitle\nrc=$?; if [[ $rc != 0 ]]; then echo "error"; exit $rc; fi\necho $rc; \nspause\n} # Test:\n#\n#* function setst - sets the name of the sub-title tiddle \nfunction setst(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# curl -T banana.title http://the:end@docbox.flint.com:1980/banana/tiddlers/SiteTitle\nshowt > /dev/null\necho $var2 > proj.stitle\ncurl -T proj.stitle http://$uid:$pass@$tiddleurl/$proj/tiddlers/SiteSubtitle\nrc=$?; if [[ $rc != 0 ]]; then echo "error"; exit $rc; fi\necho $rc; \nspause\n} # Test:\n#\n#\n#* function mktdl - creates an indivitual tiddle \nfunction mktdl(){\n#debug \nshowt > /dev/null\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\ntiddle=$var2\necho "Making "$tiddle\necho $tiddle > $proj.$tiddle\ncurl -T proj.$tiddle http://$uid:$pass@$tiddleurl/$proj/tiddlers/$tiddle\nrc=$?; if [[ $rc == 0 ]]; then echo "tiddle "$tiddle" made."; exit $rc; fi\necho $rc; \nspause\n} # Test:\n#\n#* function popgp - populates the grant proposal \nfunction popgp(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nshowt # > /dev/null\n#debug spause\nfor tiddle in TitlePage Summary Introducion FundingSources ProblemNeed Methods Reports Future Budget\ndo\n echo "making "$tiddle\n echo $tiddle > $proj.$tiddle\n curl -T $proj.$tiddle http://$uid:$pass@$tiddleurl/$proj/tiddlers/$tiddle\ndone\n#debug spause\n} # Test: chello.sh popgp\n#\n#* function overview - creates the overview tiddle and populates it\nfunction overview(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nshowt > /dev/null\n#\npopgp #make categories\n#\n# make DefaultTiddlers file...\ntiddle=DefaultTiddlers\nttopic=overview\necho "making "$ttopic\nrm -rf $proj.$tiddle\necho "[["overview"]]" >> $proj.$tiddle\ncurl -T $proj.$tiddle http://$uid:$pass@$tiddleurl/$proj/tiddlers/$tiddle\necho "OK uploaded"\nrc=$?; if [[ $rc == 0 ]]; then echo "tiddle "$tiddle" made."; fi\necho $rc; \n# spause\n#\n# make the overview file\ntiddle=overview\necho "Starting to make "$proj.$tiddle\nrm -rf $proj.$tiddle\nfor ttopic in TitlePage Summary Introducion FundingSources ProblemNeed Methods Reports Future Budget\ndo\n echo "making "$ttopic\n echo "# [["$ttopic"]]" >> $proj.$tiddle\ndone\n#\necho "Uploading "$proj.$tiddle\ncurl -T $proj.$tiddle http://$uid:$pass@$tiddleurl/$proj/tiddlers/$tiddle\nrc=$?; if [[ $rc == 0 ]]; then echo "tiddle "$tiddle" made."; exit $rc; fi\necho $rc; \n# echo "Uploaded "$proj.$tiddle\necho "Erasing all files begining with "$proj"."\necho "This includes: "\nls -alt $proj.*\nspause\nrm -rf $proj.*\n# echo $tiddle\n#\n} # Test: chello.sh\n#\n#* function dlt - Download relevant tiddles\nfunction dlt(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nspause\nread -d '' String <<"EOF"\n#!/usr/bin/expect -f\nset tiddleurl [lindex $argv 0]\nset user [lindex $argv 1]\nset pass [lindex $argv 2]\nset proj [lindex $argv 3]\nspawn /usr/bin/cadaver http://$tiddleurl/\nexpect "Username:"\nsend "$user\s\sn"\nexpect "Password:"\nsend "$pass\s\sn"\nexpect "dav:"\nsend "cd $proj\s\sn"\nexpect "dav:"\nsend "cd tiddlers\s\sn"\nexpect "dav:"\nsend "ls\s\sn"\nexpect "dav:"\nsend "quit\s\sn"\nEOF\necho "this is the project "$proj\necho "$String" > doit.exp\nchmod +x doit.exp\n# debug \n./doit.exp $tiddleurl $uid $pass $proj | grep "^ " > slug.dir\nsed 's/^ //g' slug.dir | # Pipe throught filters\n grep -vi "Basic_Editing" | # \n grep -vi "FormattingInstructions" > $proj.dir \ncat $proj.dir\n#| grep succeeded\n#debug > /dev/null\n#\n#debug \nspause\n} # Test:\n#\n#* function dlr - Rename and fill stuff in between braces\nfunction dlr(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#debug \nshowt > /dev/null\n# debug\nn=1\ncurl -s http://$uid:$pass@$tiddleurl/$proj/tiddlers/overview |tr -d "# [[" | tr -d "]]"| while read line;\ndo\necho -e $n"\st"$line\n((n++))\ndone\n} # Test:bin/chello.sh dlr (assume that ss is right)\n#\n#\n######################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script does not need to run as root but that's OK as you are not root" 1>&2\nfi\n} # Test:~flint/bin/chello.sh uroot\n#\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n# echo "chello.sh v"$version" starts"\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n# ARGS=$# # carries the number of args into the functions...\nif [ "$#" -eq "4" ] && [ "$1" = "sett" ]; then ARGS="4"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "showt" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "maket" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "remt" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "settt" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "setst" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "popgp" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "mktdl" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dlt" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dlr" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "overview" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#debug echo $#" "$1" "$2" "$3" "$ARGS ;spause \n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; $1="help"; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") defvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. To TEST:\n#\n# echo " ";\necho "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug echo "That's all folks!!"\n#\n#debug rm -rf ss # removes super secret data file\n#* restore environment\ncd "$S"\n}}}
{{{\n#!/bin/bash\n# Wed 21 Jan 2015 07:17:44 AM EST Microsoft Word Filter for Grant Generator \n# Note change in evaluation of ARG!\n# \nversion="0.05"\n#\n# next lines run ballisticly\n#* hold environment\nS=$PWD\n# echo "This is the path "$S\n#\n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; uroot #debug \ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is mswf.sh, a tiddle based proposal generator.\n## This is released under GPL I\n## The syntax is:\n## - mswf.sh ounzip <folder> <filename> - Blows open an odf\n## - mswf.sh ozip <folder> <filename> - makes odf \n## - mswf.sh val <folder> validates content of xml or pyx\n## - mswf.sh inst <folder> <filename> - puts filename in content.\n## - mswf.sh tpyx <folder> <destfn.odt> <target.pyx> tests document\n## - mswf.sh gpyx <folder> <filename.pyx> gets pyx out as filename.pyx \n## - mswf.sh pdfit <filename>.odt converts to filename.pdf, tests\n## - mswf.sh \n## in all of these, Output is delivered to the screen...\n## *** NOTE *** This program need not be run as root!\n##\n## For structure information type "grep '^\s#\s*' mswf.sh"\n## :^)\n## (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n##\n# *****Documentation Loop ends here the rest is function******\n#\n} # Test: mswf.sh\n#\n#* function dummy - Rename and fill stuff in between braces\nfunction dummy(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test:\n#\n#\n#* check location of vital files and programs, sanity check\nfor prog in curl expect cadaver xmlstarlet git unoconv # debug banana xsltproc\ndo\n# echo $prog\nisit=$(which $prog)\n# echo $isit \nif [ ! -f "$isit" ]\nthen\n echo "This program needs $prog which is not installed on this system."\n echo "Type \s"sudo apt-get install $prog\s" to fix this."\n exit 0\nfi\ndone\n#\n# Define files to be used\n# \n# qualify user\n# uid="" ; if [ "$uid" == "" ]; then echo "Set user id!"; exit; fi\n# passwd="" ; if [ "$passwd" == "" ]; then echo "Set user passwd!"; exit; fi\n# echo "Check if you are root"\n# uroot()\n# exit\n#\n# above runs ballisticly\n#\n#* function ounzip - ounzip <folder> <filename> - Blows open an odf.\nfunction ounzip(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\ndrnme=$var2 #debug; echo "Directory is "$drnme\nfname=$var3 #debug; echo "File is "$fname\n#\nrm -rf $drnme > /dev/null\nmkdir $drnme\n#debug echo "Change to this directory"\ncd $drnme\n#debug echo "Expand the file"\nunzip ../$fname > /dev/null\n#debug \nspause\n} # Test: \n#\n#\n#* function ozip - ozip <folder> <filename> - makes odf \nfunction ozip(){\n# note that ozip is a reserved word, so do not use it as a function name...\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\ndrnme=$var2; echo "Directory is "$drnme\nfname=$var3; echo "File is "$fname\n#debug spause\n#\n# change to this directory \ncd $drnme\npwd\n#debug spause\n#\n#debug echo "Make the mimetype"\nzip -0 -X ../$fname mimetype\n#debug echo "Add the rest of the xml"\nzip -r ../$fname * -x mimetype\n#debug spause\ncd ..\nlibreoffice $fname\n} # Test: mswf.sh ozip test1 test6.odt\n#\n#* function val - <folder> validates content.xml\nfunction val(){\n#debug echo "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\nfname=$var2; echo "fname is "$fname\npre=${fname:0:${#fname}-4};echo "Prefix is "$pre\next=${fname:${#fname}-3:3};echo "Extention is "$ext\n#debug echo $pre" "$ext\n#debug ; echo -n "File is "$fname\ncase "$ext" in\n "xml") xmlstarlet val $fname ;; # test as xml\n "pyx") echo -n $fname" -"; xmlstarlet depyx $fname > $pre.xml; xmlstarlet val $pre.xml | cut -d "-" -f 2;; # test as pyx\n *) clear; echo "Must be pyx or xml"; exit 1;; # Anything else run help and exit...\nesac # \n\n\n#debug spause\n} # Test: .mswf.sh val test1.xml\n#\n#* function pdfit - get content.xml as pyx\nfunction pdfit(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\nfname=$var2; echo "fname is "$fname\npre=${fname:0:${#fname}-4};echo "Prefix is "$pre\next=${fname:${#fname}-3:3};echo "Extention is "$ext\n#debug spause\nunoconv -f pdf $fname # convert to pdf\n#debug ls -alt $pre.pdf\n#debug spause\nevince $pre.pdf\n} # Test:\n#\n#* function csow - content mamipulator\nfunction csow(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nxmlstarlet depyx content.pyx > testd1/content.xml; \nxmlstarlet val testd1/content.xml|while read line; do echo $line; done\nxmlstarlet depyx content.pyx > contentn.xml; xmlstarlet val contentn.xml\n} # Test:\n#\n#\n#* function tpyx - tests content.xml \nfunction tpyx(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\ndrnme=$var2; echo "Directory is "$drnme\nfname=$var3; echo "fname is "$fname\nfnami=$var4; echo "fnami is "$fnami\n#debug spause\n#\nxmlstarlet depyx $fnami > $drnme/content.xml \nxmlstarlet val $drnme/content.xml\nspause\nozip > /dev/null\n# $|while read line; do echo $line; done\n} # Test:\n#\n#* function gpyx - get content.xml as pyx\nfunction gpyx(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\ndrnme=$var2; echo "Directory is "$drnme\nfname=$var3; echo "fname is "$f${fname:${#fname}-3:3}name\n# fnami=$var4; echo "fnami is "$fnami\n#debug spause\nxmlstarlet pyx $drnme/content.xml > ./$fname\n} # Test:\n#\n######################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script does not need to run as root but that's OK as you are not root" 1>&2\n exit 1\nfi\n} # Test:~flint/bin/mswf.sh uroot\n#\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\n#\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n# echo "mswf.sh v"$version" starts"\n#* Evaluator Routine\n# the evaluator must have 1 argument \n# Note the evaluator allows for many cases and error checking...\n# ARGS=$# # carries the number of args into the functions...\nif [ "$#" -eq "3" ] && [ "$1" = "ounzip" ]; then ARGS=$# ; fi\nif [ "$#" -eq "3" ] && [ "$1" = "ozip" ]; then ARGS=$# ; fi\nif [ "$#" -eq "2" ] && [ "$1" = "val" ]; then ARGS=$# ; fi\nif [ "$#" -eq "2" ] && [ "$1" = "remt" ]; then ARGS=$# ; fi\nif [ "$#" -eq "2" ] && [ "$1" = "unzipt" ]; then ARGS=$# ; fi\nif [ "$#" -eq "4" ] && [ "$1" = "tpyx" ]; then ARGS=$# ; fi\nif [ "$#" -eq "1" ] && [ "$1" = "popgp" ]; then ARGS=$# ; fi\nif [ "$#" -eq "3" ] && [ "$1" = "gpyx" ]; then ARGS=$# ; fi\nif [ "$#" -eq "2" ] && [ "$1" = "pdfit" ]; then ARGS=$# ; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS=$# ; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS=$# ; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS=$# ; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS=$# ; fi\n# this tests the evaluator...\n#debug echo $#" "$1" "$2" "$3" "$ARGS ;spause \n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; $1="help"; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") defvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and unziple variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and unziple variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. To TEST:\n#\n# echo " ";\n#debug echo "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug echo "That's all folks!!"\n#\n#debug rm -rf ss # removes super secret data file\n#* restore environment\ncd "$S"\n}}}
This is no where near finished code, it is more of a sketch...\n\nFire it off using this monster...\n{{{\nrm -rf test.pyx test/content.xml ;bin/pycs2.sh > test.pyx;bin/mswf.sh tpyx test test.odt test.pyx # end-to-end\n}}}\n\n{{{\n#!/bin/bash\n# pflint Thu 22 Jan 2015 11:52:41 AM EST \n# Bull In China Shop approach to content.xml\n#\n#\n# Output the header stuff\n#debug spause\n# packs expect and sends it out...\n# \n# From this line to EOF is the code to export\n# note slash escapes (\s\s)\nread -d '' header <<"EOF"\nC Begin Document - Begin Header\n(office:document-content\nAxmlns:office urn:oasis:names:tc:opendocument:xmlns:office:1.0\nAxmlns:style urn:oasis:names:tc:opendocument:xmlns:style:1.0\nAxmlns:text urn:oasis:names:tc:opendocument:xmlns:text:1.0\nAxmlns:table urn:oasis:names:tc:opendocument:xmlns:table:1.0\nAxmlns:draw urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\nAxmlns:fo urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\nAxmlns:xlink http://www.w3.org/1999/xlink\nAxmlns:dc http://purl.org/dc/elements/1.1/\nAxmlns:meta urn:oasis:names:tc:opendocument:xmlns:meta:1.0\nAxmlns:number urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\nAxmlns:svg urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\nAxmlns:chart urn:oasis:names:tc:opendocument:xmlns:chart:1.0\nAxmlns:dr3d urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\nAxmlns:math http://www.w3.org/1998/Math/MathML\nAxmlns:form urn:oasis:names:tc:opendocument:xmlns:form:1.0\nAxmlns:script urn:oasis:names:tc:opendocument:xmlns:script:1.0\nAxmlns:ooo http://openoffice.org/2004/office\nAxmlns:ooow http://openoffice.org/2004/writer\nAxmlns:oooc http://openoffice.org/2004/calc\nAxmlns:dom http://www.w3.org/2001/xml-events\nAxmlns:xforms http://www.w3.org/2002/xforms\nAxmlns:xsd http://www.w3.org/2001/XMLSchema\nAxmlns:xsi http://www.w3.org/2001/XMLSchema-instance\nAxmlns:rpt http://openoffice.org/2005/report\nAxmlns:of urn:oasis:names:tc:opendocument:xmlns:of:1.2\nAxmlns:xhtml http://www.w3.org/1999/xhtml\nAxmlns:grddl http://www.w3.org/2003/g/data-view#\nAxmlns:officeooo http://openoffice.org/2009/office\nAxmlns:tableooo http://openoffice.org/2009/table\nAxmlns:drawooo http://openoffice.org/2010/draw\nAxmlns:calcext urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0\nAxmlns:loext urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0\nAxmlns:field urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0\nAxmlns:formx urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0\nAxmlns:css3t http://www.w3.org/TR/css3-text/\nAoffice:version 1.2\n-\sn \n(office:scripts\n)office:scripts \n(office:font-face-decls \n(style:font-face\nAsvg:font-family FreeSans\nAstyle:font-family-generic swiss\nAstyle:name FreeSans1\n)style:font-face \n(style:font-face\nAsvg:font-family 'Liberation Serif'\nAstyle:font-family-generic roman\nAstyle:font-pitch variable\nAstyle:name Liberation Serif\n)style:font-face \n(style:font-face\nAsvg:font-family 'Times New Roman'\nAstyle:font-family-generic roman\nAstyle:font-pitch variable\nAstyle:name Times New Roman\n)style:font-face \n(style:font-face\nAsvg:font-family Arial\nAstyle:font-family-generic swiss\nAstyle:font-pitch variable\nAstyle:name Arial\n)style:font-face \n(style:font-face\nAsvg:font-family 'Droid Sans Fallback'\nAstyle:font-family-generic system\nAstyle:font-pitch variable\nAstyle:name Droid Sans Fallback\n)style:font-face \n(style:font-face\nAsvg:font-family FreeSans\nAstyle:font-family-generic system\nAstyle:font-pitch variable\nAstyle:name FreeSans\n)style:font-face \n)office:font-face-decls \n(office:automatic-styles \n(style:style\nAstyle:family paragraph\nAstyle:list-style-name \nAstyle:name P1\nAstyle:parent-style-name Heading_20_1 \n(style:paragraph-properties\nAstyle:auto-text-indent false\nAfo:margin-left 0in\nAfo:margin-right 0in\nAfo:text-indent 0in\n)style:paragraph-properties \n)style:style \n(style:style\nAstyle:family paragraph\nAstyle:master-page-name Standard\nAstyle:name P2\nAstyle:parent-style-name Heading_20_1 \n(style:paragraph-properties\nAstyle:page-number auto\n)style:paragraph-properties \n)style:style \n)office:automatic-styles \nC End header\nEOF\n#\n#\n# Output section1\nread -d '' section1 <<"EOF"\n(office:body \n(office:text\nAtext:use-soft-page-breaks true \n(office:forms\nAform:apply-design-mode false\nAform:automatic-focus false\n)office:forms \n(text:sequence-decls \n(text:sequence-decl\nAtext:display-outline-level 0\nAtext:name Illustration\n)text:sequence-decl \n(text:sequence-decl\nAtext:display-outline-level 0\nAtext:name Table\n)text:sequence-decl \n(text:sequence-decl\nAtext:display-outline-level 0\nAtext:name Text\n)text:sequence-decl \n)text:sequence-decls\nC Begin Interest \n\nC Begin Major Heading\n(text:p\nAtext:style-name P1\n-PROGRAM PLANNING AND PROPOSAL WRITING \n)text:p\nC Skip Line Major Heading\n(text:p\nAtext:style-name P1 \n)text:p\nC Next Line Major Heading\n(text:p\nAtext:style-name P1\n-(Major Heading)\n)text:p\n\n\n(text:list\nAxml:id list8613520842505776682\nAtext:style-name WW8Num3\nC Title Header \n-\sn\nC Begins the Text\n\n(text:list-item \n(text:h\nAtext:outline-level 1\nAtext:style-name P2\n-PROGRAM PLANNING AND PROPOSAL WRIRING\n)text:h\n \n)text:list-item\nC Numbered Element \n(text:list-item \nC numbered heading here \n\n)text:list-item \n)text:list\nC Normal Text \n- \sn \nC Text item goes here\n\n(text:list\n\n \n(text:list-item \nC Text item goes here\n)text:list-item \n)text:list \n\n(text:list\n\n(text:list-item\nC Begin Numbered Headings \n\n(text:list\n\nC Start List\nC One heading element\n\nC End of list-item\n(text:list-item\n\nC Closing time everything below must stay\n)text:list-item \n)text:list\n)text:list-item \n)text:list \n)office:text \n)office:body\nEOF\n#\n# Output Text\nread -d '' text <<"EOF"\n STUFF\nEOF\n#\n# Output Header 2\nread -d '' section2 <<"EOF"\n STUFF\nEOF\n#\n# Output Footer\nread -d '' footer <<"EOF"\nC test number 3\n)office:document-content\nC Document END \nEOF\n#\n#debug cat header1.pyx\n# do not forget the quotes!\n# echo "$header"\n# cat section1.pyx\n#debug echo "$section1"\n# echo "$footer"\n#debug cat header1.pyx\n# do not forget the quotes!\n#debug \necho "$header"\n#debug \necho "$section1"\n#debug cat section1.pyx\n#debug \necho "$footer"\n#debug echo "$header"; echo "$section1"; echo "$footer"\n#debug cat header.pyx; echo "C Section1"; cat section1.pyx; echo "footer"; cat footer.pyx\n#debug cat header.pyx\n#debug cat section1.pyx\n#debug cat footer.pyx\n\n}}}
Type the text for 'New Tiddler'
Type the text for 'New Tiddler'
Type the text for 'New Tiddler'
\n{{{\n#!/bin/bash\n# pflint 12/15/2015 09:36:08 AM\n# \n# The variables we need:\nfilename=$1".sh"\nauthor=\s"$USER\s"\nplatform=\s"$HOSTNAME\s"\ndadate=$(date +%F)\ndatetime=$(date +%F" "%X)\ndayear=$(date +%Y)\ndamaintainer=\s"$USER\s"\ndaemail=\s"need\s this\s"\ndastatus=\s"prototype\s"\ndaapname=\s"headcheese.sh\s"\ndaverion=\s"0.001\s"\n#\n# Generates a header of sorts...\n#\ncat << end > $1.sh\n#!/usr/bin/python\n# -*- coding: utf-8 -*-\n#\n# The includes:12/09/2015\n# stick your includes in here\n#\n# Boilerplate inports for Python 2 / Python 3 mutual compatiibility\n#\n# from __future__ import print_function # Make print a function\nfrom six.moves import input # Use raw_input when I say input\nfrom os.path import expanduser # Cross-platform home directory finder\n\n# This is completely stolen from Kevin Cole, as he is the master... \n__author__ = $author\n__copyright__ = "Copyright $dayear, Goddard College ($dadate)"\n__credits__ = ["Flint"] # Authors and bug reporters\n__license__ = "GPL"\n__version__ = $daverion\n__maintainer__ = $damaintainer\n__email__ = $daemail\n__status__ = $dastatus # "Prototype", "Development" or "Production"\n__appname__ = $daapname\n\n#\nend\n# \nchmod +x $1.sh\n#\necho "Now we test this header and see if we like it..."\nread -p "Hit enter to continue..." ans\n#\n./$1.sh\n\n}}}
Most users that think of BASH think of it as a prompt and a command line. That is BASH in interactive mode. BASH can also run in non-interactive mode, as when executing scripts. [[SOURCE:|http://mywiki.wooledge.org/BashGuide]]\n\n[[explain shell|http://explainshell.com/]]\n\n[[Mike's Bash Guide|http://mywiki.wooledge.org/BashGuide]]
* [[argbash|https://github.com/matejak/argbash]]\n* [[Bash Sticker Giveaway|https://github.com/MaxCDN/shml/wiki/Official-Bash-Sticker-Giveaway]]
'' Visual Bash ''\n2017-12-01 [[Please Visit Our Wikipedia Page|https://en.wikipedia.org/wiki/Draft:VisualBash]]\n2017-06-11 [[SELF Presentation|http://docbox.flint.com/~flint/self/visual_bash_self_2017-06-11.pdf]] \n2017-06-21 [[vmWorkshop Presentation|http://docbox.flint.com/~flint/vmworkshop2017/Paul_Flint_-_visual_bash_2017-06-25.pdf]] \n2017-08-11 [[SHARE 2017 Presentation|http://docbox.flint.com/~flint/share_2017/SHARE_Presentation_Visual_Bash_2017-07-26.ppt]]\n2013-03-06 [[SHARE 2018 Presentation|http://docbox.flint.com/~flint/share_2018/SHARE_Presentation_Visual_Bash_2018-03-06.ppt]]\n\n\nVisual Bash is actually beyond merely being a way to bate the Microsoft legal department. It is, in fact, a disciplined framework for rapid development of very agile Bash scripts used typically in [[DevOps|https://en.wikipedia.org/wiki/DevOps]] environments. Visual Bash allows for clear documentation and flexible implementation of shell scripts in this type of operational and reliability oriented environment\n\nThe Barre Open Systems Institute of Vermont has developed and taught this programming technique to several of our graduates who have gone on to professional operational activities. Finally this fascination with bash has led to some disturbing, disruptive and humorous behavior which will be demonstrated and discussed in this and subsequent sections of this linked document.\n\nThe Visual Bash framework conceptually is comprised of three easy to remember elements:\n# ''Functions'' - lots and lotsa functions... \n# The ''Evaluator'' \n# The ''Dispatcher''\n\nRemember ''FED''...\n\nTo date good Visual Bash insists that each program contain \n\n# At the top, a help function\n\nthree elements:\n\n1. A menu area describing how to use keywords,\n2. An argument counting parser, and finally\n3. A case statement that routes supplied input to specific functions.\n\nAll of the rest is functions.\n\n'' Visual Bash Structure''\n\nThe goal is to get options, positional arguments and command usage patterns as close as possible to POSIX, IEE 1003.1. A vivid example of this is now in Python.\n* See [["docopt".|http://docbox.flint.com:8081/geekland#PythonCore]] \n\nVisual Bash is comprised of the following sections:\n# Savings\n# Help Message\n# Dummy Function\n# Acutal Functions\n# Useful Functions\n# Parser\n# Restorals\n\nEven with the [[Visual Bash include function|VisualBashIncludes]] expansion is possible even beyond the [[namespace problem|VBNameSpaceProblem]], remember [[bash gotchas|https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjF8uDmuezRAhVk_4MKHRBHBysQFggcMAA&url=http%3A%2F%2Ftldp.org%2FLDP%2Fabs%2Fhtml%2Fgotchas.html&usg=AFQjCNElFKFr5L3r053T4PkDCN8saeUyjA]]\n\n
Type the text for '30 March 2016'\n\n[[Yes, here is the Bash for Windows 10 announcement|http://www.zdnet.com/article/heres-how-microsoft-will-support-bash-on-windows-10/]]
'15 April 2016'\n\nVisual Bash security architecture really sucks right now. The current practice is to set up a protected secrets file.\n\nEric-the-Weasel suggested doing something along the Linux "Seahorse" approach, and I countered by saying that we need something that would work at the command line. The answer is to part, [[libsecret-tools|https://packages.debian.org/sid/admin/libsecret-tools]] and [[libsecret-cli|https://github.com/Lyude/libsecret-cli]]. Watch this space for more developments!
'6 May 2016'\n\nAdded new security and sanity functions to this code:\n\n{{{\n#!/bin/bash\n# pflint Fri 30 Jan 2015 04:04:36 PM EST04/13/2016 08:35:36 PM \n# 04/13/2016 08:35:27 PM \n# - fix security into ss \n# - sanify code\n# - establish variables once\n# \n# Indexes Tiddlers On Zope Server\nversion="0.05"\n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; uroot #debug \ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is mtoc.sh, a damn bad tiddle show-er.\n## This is released under GPL dbtsI\n## The syntax is:\n## - mtoc.sh dss <Tiddle URL> <USER> - \n## sets the tiddlewiki, id & secrets \n## - mtoc.sh sets <Tiddle URL> <USER> <PASS> - \n## sets the tiddlewiki, id & secrets \n## - mtoc.sh shows - shows the name of the \n## shows the tiddlewiki, id & secrets \n## - mtoc.sh suck <FILENAME> - gets the tiddles urls into file \n## - mtoc.sh doit - <SUBDIR> downloads all tiddles to subdir\n## - mtoc.sh find <String> - Search for string in downloaded \n## - mtoc.sh clear <FILENAME> - removes a <FILENAME> and\n## - destroys secrets file\n## - mtoc.sh cover <SUBDIR> - removes a <SUBDIR> \n## in all of these, Output is delivered to the screen...\n## *** NOTE *** This program need not be run as root!\n##\n## For structure information type "grep '^\s#\s*' mtoc.sh"\n## :^)\n## (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n##\n# *****Documentation Loop ends here the rest is function******\n#\n} # Test: mtoc.sh\n# next lines run ballisticly\n#* hold environment\nS=$PWD\n# echo "This is the path "$S\n# debug\n#\n# Define files to be used\n#* function ch4ps - checks and reports on what you need.\nfunction ch4ps(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n#* check location of vital files and programs, sanity check\nrm -rf need > /dev/null\nfor prog in curl expect cadaver xmlstarlet git secret-tool\ndo\n # echo $prog\n isit=$(which $prog)\n # echo $isit \n if [ ! -f "$isit" ];\n then\n echo $prog >> need\n #debug echo "Type \s"sudo apt-get install $prog\s" to fix this."\n #debug spause\n # exit 0\n fi\ndone\nclear\necho "Welcome to $0!"\necho "Missing programs:"\n if [ -f need ];\n then\n echo " This program needs the following program(s) to be installed on this system."\n cat need |while read line; do echo -e \s\st" - " $line; done\n echo " If you want them installed please logon as root (sudo $0) and they will install"\n exit 0 # breaks you out of loop...\n else\n echo " * None * Looks like the pot's right, lets play!"\n fi\n#\necho "end of check"\n} # Test:\n#\n#\n#* function instg - # installs extra software if you are root, installs all the good stuff\nfunction instg(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nif [ "$(id -u)" = "0" ] && [ -f need ]; then\n echo "You are root and you are about to install the following:" 1>&2\n cat need |while read line; do echo -e \s\st" - " $line; done\n read -p "Hit enter to continue and install..." an\n #debug\n cat need |while read line; do apt-get install $line; done\n #debug cat need |while read line; do echo -e \s\st" - " $line; done\nfi\nrm -rf need\n#debug exit 0 # breaks you out of loop...\n} # Test:\n# \n# next lines run ballisticly\n#debug \ninstg # installs extra software if you are root\nch4ps # checks and reports on what you need.\n# above runs ballisticly\n#\n#* function dummy - Rename and fill stuff in between braces\nfunction dummy(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test:\n#\n#####################################Put stuff here!\n#\n#* function dss - uses secret-store to gain password\nfunction dss(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# use this command to store a password "secret-tool store --label=zope user <userid>"\ntiddleurl=$var2;user=$var3\necho $user\npass=$(secret-tool lookup user $user)\nrm -rf ss\n#\necho -e " TiddleURL is\st"$tiddleurl \necho -e " User is \st"$user\necho -e " PASS is \st"$pass\n#\n#d spause\n#\ntouch ss\necho $tiddleurl >> ss\necho $user >> ss\necho $pass >> ss\n\nif [ "$pass" ]; then\n echo -n "ss is in "; pwd\nelse\n echo "password is not good"\n rm -rf ss\n #d spause\nfi\n} # Test dss the\n#\n#* function sets - sets the name and logon for tiddlewiki you want to work on\nfunction sets(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nrm -rf ss\ntiddleurl=$var2;user=$var3;pass=$var4\n#\necho -e " TiddleURL is\st"$tiddleurl \necho -e " User is \st"$user\necho -e " PASS is \st"$pass\n#\ntouch ss\necho $tiddleurl >> ss\necho $user >> ss\necho $pass >> ss\n#\nspause\n} # Test: ./mtoc.sh sets one two three\n#\n#* function shows - shows the url, user and secrets you are currently working on\nfunction shows(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nIFS=$'\sn' ss=($(cat ss 2>/dev/null))\n# [[ ${ss[1]} = $name ]] && echo "${a[$i]}"\ntiddleurl=${ss[0]};\nuser=${ss[1]};\npass=${ss[2]}\nproj=${ss[3]}\n#\necho -e " TiddleURL is\st"$tiddleurl \necho -e " User is \st"$user\necho -e " Pass is \st"$pass\necho -e " Project is \st"$proj\n#\n#debug spause\n} # Test: ./mtoc.sh shows\n#\n#* function find - Finds a String in the result..\nfunction find(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\necho "This needs work"\ncd tiddlers #fix this...\nfind . 2>/dev/null |xargs grep robot 2>/dev/null\n\n} # Test:\n#\n#\n#* function gdtml gets the DTML files from a specific directory in zope\nfunction gdtml(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\nshows > /dev/null # loads url, use & secrets\n#\nsubdir=$line\n# pwd\n#d \necho -e " TiddleURL is\st"$tiddleurl \necho -e " User is \st"$user\necho -e " PASS is \st"$pass\necho -e " PROJECT is \st"$proj\necho "arg0="$tiddleurl", arg1="$user", arg2="$pass", arg3="$subdir;read -p "Hit enter to continue..." ans\n#\ncd tiddlers\n# \n[[ -d $subdir ]] || mkdir $subdir\ncd $subdir\npwd\n#\n# packs expect and sends it out...\n# \n# From this line to EOF is the code to export\n# note slash escapes (\s\s)\nread -d '' String <<"EOF"\n#!/usr/bin/expect -f\nset tiddleurl [lindex $argv 0]\nset user [lindex $argv 1]\nset pass [lindex $argv 2]\nset subdir [lindex $argv 3]\n# puts "Argument data:";\n# puts "tiddleurl: $tiddleurl";\n# puts "user: $user";\n# puts "pass: $pass";\n# puts "subdir: $subdir";\n# check...\nif { $user == "" || $pass == "" || $tiddleurl == "" || $subdir == "" } {\n puts "Usage: <tiddleurl> <user> <pass> <subdir> "\n exit 1\n}\nspawn /usr/bin/cadaver http://$tiddleurl/$subdir/tiddlers\nexpect "Username:"\nsend "$user\s\sn"\nexpect "Password:"\nsend "$pass\s\sn"\nexpect "dav:"\nsend "mget *\s\sn"\nexpect "dav:"\nsend "quit\s\sn"\nEOF\n#d echo "this is the subdirectory "$subdir\necho "$String" > doit.exp\nchmod +x doit.exp\n#d echo "arg0="$tiddleurl", arg1="$user", arg2="$pass", arg3="$subdir\n#d read -p "Hit enter to continue..." ans\n#./doit.exp $tiddleurl $user $pass $subdir \n#d echo "arg0="$tiddleurl", arg1="$user", arg2="$pass", arg3="$subdir;read -p "Hit enter to continue..." ans\n./doit.exp $tiddleurl $user $pass $subdir \n#d rm -rf doit.exp\n#\ncd ../../\n} # Test: ./mtoc.sh gdtml \n#\n#\n#* function suck <SUBDIRNAME> - makes a <SUBDIRNAME> in the current tiddlewiki\nfunction suck(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\n#\nshows > /dev/null # loads url, use & secrets\n#\nfname=$var2\necho $fname >> ss\n# pwd\n#d \n#d echo -e " TiddleURL is\st"$tiddleurl \n#d echo -e " User is \st"$user\n#d echo -e " PASS is \st"$pass\n#d echo -e " FNAME is \st"$fname\n#d echo "arg0="$tiddleurl", arg1="$user", arg2="$pass", arg3="$fname;read -p "Hit enter to continue..." ans\n#\n# packs expect and sends it out...\n# \n# From this line to EOF is the code to export\n# note slash escapes (\s\s)\nread -d '' String <<"EOF"\n#!/usr/bin/expect -f\nset tiddleurl [lindex $argv 0]\nset user [lindex $argv 1]\nset pass [lindex $argv 2]\nset subdir [lindex $argv 3]\n# put strings very useful\n# puts "Argument data:";\n# puts "tiddleurl: $tiddleurl";\n# puts "user: $user";\n# puts "pass: $pass";\n# puts "subdir: $subdir";\n# check...\n# if { $user == "" || $pass == "" || $tiddleurl == "" || $subdir == "" } {\nif { $user == "" || $pass == "" || $tiddleurl == "" } {\n puts "Usage: <tiddleurl> <user> <pass> <subdir> "\n exit 1\n}\nspawn /usr/bin/cadaver http://$tiddleurl/$subdir\nexpect "Username:"\nsend "$user\s\sn"\nexpect "Password:"\nsend "$pass\s\sn"\nexpect "dav:"\nsend "ls\s\sn"\nexpect "dav:"\nsend "quit\s\sn"\nEOF\necho "This records the root directory entries of $tiddleurl in '$fname' "\necho "$String" > doit.exp\nchmod +x doit.exp\n#d echo "arg0="$tiddleurl", arg1="$user", arg2="$pass", arg3="$subdir\n#d read -p "Hit enter to continue..." ans\n#d ./doit.exp $tiddleurl $user $pass $subdir \n#d \n./doit.exp $tiddleurl $user $pass $subdir | grep "^Coll:" |\n cut -c 9- |\n tr -s " " | \n cut -d " " -f 1 > $fname\n#d rm -rf doit.exp\n#\n} # Test: ./mtoc.sh suck banana\n#\n#\n#* function gtdlu <SUBDIRNAME> - makes a <SUBDIRNAME> dump of the tiddles\nfunction gtdlu(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\nshows > /dev/null # loads url, use & secrets\n#d \necho -e " TiddleURL is\st"$tiddleurl \n#d \necho -e " User is \st"$user\n#d \necho -e " PASS is \st"$pass\n#d \necho -e " FNAME is \st"$fname\n#d \necho "arg0="$tiddleurl", arg1="$user", arg2="$pass", arg3="$fname;read -p "Hit enter to continue..." ans\n#\ntdl=0\ncat $fname |while read line \ndo \n # echo "You are currently in: "$line\n # this is the name of the subdirectory you are in\n ./doit.exp docbox.flint.com:1980 the end $line | grep "^Coll:" |cut -c 9- |tr -s " " | cut -d " " -f 1 |while read subd\n do\n # echo $subd\n if [[ "$subd" == *"tiddlers"* ]]; then \n echo $tiddleurl"/"$line"/"$subd |tee -a tidlurls; fi\n # echo $tdl" "$tiddleurl"/"$line"/"$subd |tee -a tidlurls; fi\n mkdir -p $subd"/"$line\n # cd $subd"/"$line\n # pwd; read -p "Hit enter to continue..." ans\n gdtml\n ((tdl++)); \n done \ndone\n#\n} # Test: ./mtoc.sh gtdlu \n#\n######################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script does not need to run as root but that's OK as you are not root" 1>&2\nfi\n} # Test:~flint/bin/mtoc.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n# echo "mtoc.sh v"$version" starts"\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n#d ARGS=$# # carries the number of args into the functions...\nif [ "$#" -eq "4" ] && [ "$1" = "sets" ]; then ARGS="4"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "shows" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "suck" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "gdtml" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "find" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "doit" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "find" ]; then ARGS="2"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "dss" ]; then ARGS="3"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "cut" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "cover" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#d echo $#" "$1" "$2" "$3" "$ARGS ;spause \n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; $1="help"; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") defvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. To TEST:\n#\n# echo " ";\necho "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug echo "That's all folks!!"\n#\n#d rm -rf ss # removes super secret data file\n#* restore environment\ncd "$S"\n\n}}}
'20 July 2016'\n\nUsing Visual Bash as a tool for generating Charm "Hooks" seems like a reasonable idea.\n\nYou need to add the following [[set command|https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html]]\n{{{\nset -xe\n}}}\n\nHere is a [[video to watch for this technique|https://www.youtube.com/watch?v=ByHDXFcz9Nk]]. One good thing about Visual Bash is you can combine the functions you need and then send these out as argumented "hooks". (Captain Hook? :^)
Type the text for '17 August 2016'\n\n{{{\n#!/bin/bash\n# 08/06/2016 09:59:41 AM pflint\n# a program to catalog all the ".iso" files in the LXF DVD collection\n# pflint\n#\n# check that you are root\n#\n# Indexes LXF DVDs \n# Mounts a DVD\n# Puts an ISO on a multiboot \nversion="0.003" #2016-08-17 08:03:05 fix menu\n#\n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\n# echo "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; uroot #debug \ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is catapo.sh, a damn bad tiddle show-er.\n## This is released under GPL dbtsI\n## The syntax is:\n## - catapo.sh dss <Tiddle URL> <USER> - \n## sets the tiddlewiki, id & secrets \n## - catapo.sh sets <Tiddle URL> <USER> <PASS> - \n## sets the tiddlewiki, id & secrets \n## - catapo.sh shows - shows the name of the \n## shows the tiddlewiki, id & secrets \n## - catapo.sh suck <FILENAME> - gets the tiddles urls into file \n## - catapo.sh doit - <SUBDIR> downloads all tiddles to subdir\n## - catapo.sh find <String> - Search for string in downloaded \n## - catapo.sh clear <FILENAME> - removes a <FILENAME> and\n## - destroys secrets file\n## - catapo.sh cover <SUBDIR> - removes a <SUBDIR> \n## in all of these, Output is delivered to the screen...\n## *** NOTE *** This program need not be run as root!\n##\n## For structure information type "grep '^\s#\s*' catapo.sh"\n## :^)\n## (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n##\n} # Test:\n#\n# *****Documentation Loop ends here the rest is function******\n#\n#\n#* function dummy - Rename and fill stuff in between braces\nfunction dummy(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test:\n#\n#\n#* function mtdvd - Mounts DVD \nfunction mtdvd(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n#\ntarget=LXFDVD211.iso\n# check that "/mnt/disk" exists, if not make it.\ndir="/mnt/disk"\nif [[ ! -e $dir ]]; then\n mkdir $dir\nelif [[ ! -d $dir ]]; then\n echo "$dir already exists but is not a directory" 1>&2\nfi\n# files are stored in "/lxfdvd"\n# Mount first DVD entry in array as a loopback\n# mkdir -p /mnt/disk\nmount -o loop $target /mnt/disk\n#\n} # Test:\n#\n#\n#* function showdvd - shows you what is on the mounted dvd\nfunction showdvd(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# uroot\n# ls -1 | grep LXFDVD | sort -n | less\nls -1 | grep LXFDVD | sort -n |while read line; \ndo \n echo $line; \n mount $target $dir\ndone\n# Search mounted DVD loopback for ".iso$"\nfind $dir | grep iso$\n} # Test:\n#\n# Read directory into text array\n#\n#* function umtdvd - Unmounts the DVD\nfunction umtdvd(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n# Unmount DVD loopback\numount $dir/$target\n} # Test:\n#\n# Mount next DVD loopback\n#\n######################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2\nfi\n} # Test:~flint/bin/catapo.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n#d ARGS=$# # carries the number of args into the functions...\n#d echo "Arg# = "$#" \s$1 = "$1" \s$2 = "$2" \s$3 = "$3" \s$ARGS = "$ARGS ;spause \n#\nif [ "$#" -eq "4" ] && [ "$1" = "sets" ]; then ARGS="4"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "shows" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "suck" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "gdtml" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "find" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "doit" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "find" ]; then ARGS="2"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "dss" ]; then ARGS="3"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "cut" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "cover" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="0"; fi\nif [ "$#" -eq "0" ]; then ARGS="0"; fi\n# this tests the evaluator...\n#d echo "Arg# = "$#" \s$1 = "$1" \s$2 = "$2" \s$3 = "$3" \s$ARGS = "$ARGS ;spause \n#d echo "catapo.sh v"$version" starts" ;spause()\n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; "help";; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") defvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; exit 1;; # got nothing, display help and go\nesac # End main loop. To TEST:\n#\n# echo " ";\n#f echo "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug \n#f echo "That's all folks!!"\n#\n#d rm -rf ss # removes super secret data file\n#* restore environment\n#f cd "$S"\n#f echo "ping"\n\n}}}
From Kevin Cole\n '4 October 2016'\n\nThis ugly command stream, which, if I really understood {{{sed}}} better, could be considerably more compact, I'm sure, finds all {{{import x}}} statements and {{{from x import y}}} statements within a set of Python files:\n{{{\n grep -hr "import " *.py | \s # Find the string "import ". Don't show file names.\n sed -n "s|^ *||gp" | \s # Remove leading spaces\n sed -n "s| \s+| |gp" | \s # Change multiple spaces to single a space\n sed -n "s|#.*||gp" | \s # Remove comments\n sed -n "s| \s+$||gp" | # Remove trailing spaces\n sort | uniq | most # Show only one occurrence of each found line\n}}}\nThat little ditty first removes all whitespace from the beginnings of lines. Then it collapses all multiple spaces remaining into single spaces. Then it strips off comments. Finally, remove all whitespace from the end of the line. NOTE: The final substitution is last because the stripping of comments leaves whitespace at the end of a line.\n\nIn the {{{sed}}} lines, the {{{-n}}} says "don't print every line in the stream" but the {{{p}}} at the end says "print the changed text". In this case, we may not really need either.\n\n(Why do this? Because, one follows it with a "pip list" at the Bash prompt, in order to be sure that the system you're working on actually has all the modules you're trying to import. It DOES depend on human intelligence to know which modules are built into Python, and which need to be installed via pip.)\n
Type the text for '26 October 2016'\n\nUse code like this to import function blocks:\nNotes:\n* "#D at beginning of line is a debug statement reveal if you must.\n* The name of the main script always has suffix ".sh" \n* The name of the sub scripts always has suffix ".shi" \n* ''Big Rule:'' "sh"and "shi" files must live in the same directory, to preserve operator sanity.\n\nExample of include file:\n#[[ianda.shi]] Identification and Authorization VBScript that should be turned into an include.\n\n\nMain script contains this function which is invoked very early in the function chain.\n\n{{{\n#!/bin/bash\n# 2016/11/07 10:49:43\n# pflint\n# a program to catalog all the ".iso" files in the LXF DVD collection\n# pflint\n#\n# next lines run ballisticly\nversion="0.014"\nsd='/media/flint/Seagate Replica/lxfdvd' # location of iso images\nS=$PWD # hold environment\n#\n# Uses Multiple source includes\n# Indexes LXF DVDs \n# Mounts a DVD\n# Puts an ISO on a multiboot \n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; uroot #debug \ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is ctrantor.sh, a tool for managing trantor\n## a web server designed to serve out Linux Format DVDs.\n## *** NOTE *** This program need not be run as root,\n## *** BUT! *** Some components require root!\n## The syntax is:\n## OPERATION\n## - ctrantor.sh diriso - Lists DVD images\n## - ctrantor.sh web [on off] - Turn Web Server on or off \n## - ctrantor.sh isos [mount [<FILENAME>] unmount list] \n## mounts unmounts or lists iso images in filesystem\n## - ctrantor.sh [dvd usb] <ISO NAME> - makes dvd or usb \n## in all of these, Output is delivered to the screen...\n## MAINTENANCE\n## - ctrantor.sh newiso - Copies new DVD image\n## into repository \n## - ctrantor.sh mkitso - builds new web site from files \n## - ctrantor.sh impjpg [ISONAMEf.jpg ISONAMEb.jpg] - \n## places jpg images of cover \n## (front or back) into repository \n## - ctrantor.sh potrite - checks to see if all \n## components are there and where they should be\n## - ctrantor.sh county - Lists included scripts & functions \n## INSTALLATION\n## - ctrantor.sh sane - Checks platform to \n## determine if all components are abailable \n## if root offers to install missing parts. \n## - ctrantor.sh setup <URL NAME> setup trantor \n## if root. \n## :^)\n## (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n## This is released under GPL dbtsI\n##\n} # Test:\n#\n# *****Documentation Loop ends here the rest is function******\n#\n######################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#* function include - loads files with additioal functions not particularly a menu item.\nfunction include(){\n#D echo "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#D echo "This is the path "$S; \n#D echo "This is \s$0 "$0\nfname=$1\n#D echo "Include "$fname\nincp=""$(echo $0 |rev | cut -d"/" -f 2- |rev)"/"\nincf=$incp$fname\n#D echo "This is the sourced file "$incf\nsource $incf\nbsm+=("${BASH_SOURCE[@]}") # add current source file to variable\n#D echo "The current bash source array is:"${bsm[@]}\n#D echo $incf\n#D echo ${BASH_SOURCE[@]}\n} # Test:\n#\n#* function county - Lists all functions in any and all sources used.\nfunction county(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# Go through our copy of the BASH_SOURCE array, and output lists of subroutines \nbsa=$(echo "${bsm[@]}" | tr ' ' '\sn' | sort -u | tr '\sn' ' ')\necho "The sorted array from main include bsa is = "${bsa[@]}\n n=1\n#D echo "${bsa[@]}" | tr ' ' '\sn'|sed '/^$/d'; spause\necho "${bsa[@]}" | tr ' ' '\sn' |sed '/^$/d' |while read line; do\n echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>> sub-script #"$n:" "$line ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"\n n=$(( n+ 1 ))\n # grep -H '^\s#\s*' $line; \n grep '^\s#\s*' $line; \ndone\n} # Test:\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2\nfi\n} # Test:~flint/bin/ctrantor.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\n#* function dummy - Rename and fill stuff in between braces\nfunction dummy(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test:\n#\n######################################ACTUAL PROGRAM RELATED FUNCTIONS BELOW\n#\n# This loads the next sections of the code...\ninclude testi.shi\ninclude dvdio.shi\n#\n}}}\n\nNote that the includes follow this main section...\n\nThe "bsa" bash array variable contains the names of all the included sub scripts which are private and used in the include...\n
'31 October 2016'\nThere is such a thing as a sanity script.\n\nThe [[SanityScript|NewSane]] while born but without love, is not longer stillborn. \n\nRight now sanity does the following:\n\n* Check that all the components you need are in place in terms of program\n\nthe vision is that sanity do the following: \n* determine local variables\n* Possibly check at to the validity of the includes and functions using {{{MD5 sum}}}\n* checking that all files have unix <cr> line ending not DOS <cr/lf>\n* checking for variable conflict within functions. This is a big thing,\nbut on the other hand, so it sanity...\n\nBased upon [[this functionality|http://docbox.flint.com:8081/geekland#dupingubuntu]]\n\n# Input is a file with sanity requirements.\n# File is generated by diffing \n\n{{{\ndpkg --get-selections > package_2016-10-31\ndiff package_2016-10-31 packages_original_2016-10-31 > sanity_$(date +%F)\nsed -i 's/install//g' sanity_2016-10-31\nsed -i 's/^< //g' sanity_2016-10-31\ntail -$(( $(wc -l sanity_2016-10-31 | cut -d " " -f 1)-1 )) sanity_2016-10-31\n}}}\n\nsupported subsystems\n\n* apt-get\n* pip3\n* brew ??\n\nUnfortunately, [[Package History|http://askubuntu.com/questions/21657/how-do-i-show-apt-get-package-management-history-via-command-line]] is not as useful as you might think..,. Time is an enemy here...\n{{{\nless /var/log/apt/history.log\n}}}
"31 October 2016"\n\nMenu generator now [[menubot.sh|menubot.sh]]\n\n* pour include function into prototype\n* put vbash conditions in\n
{{{\n#!/bin/bash\n# Tue 30 Apr 2024 02:09:05 PM EDT \n# pflint\n#\nversion="0.20"\n#\n#m HOW THIS PROGRAM WORKS:\n#m menubot - a program to generate the script using FED rules\n#m based upon a text menu file submitted with a .mnu suffix\n#m Menubot processes a ".mnu" file wich is comprised of line based linked lists delimited by dashs ("-").\n#m In this source ".mnu" document these linked lists are organized by a dash, function or verb name followed by\n#m another dash and a functional description. Thus it is important that every line to be added to \n#m the resulting FED based VisualBash framework be parsed correctly.\n#m The program builds the following:\n#m Framework\n#m The framework is the syntactical sugar that enforces language sanity and dummy, Dummy is the base test of operation,'\n#m \n#\n# 1. reads the .mnu file\n# 2. parsmnu extracts functions ffile.shi and evaluators efile.shi\n# 3. Creates from the .mnu file \n# 4. Creates descriptions\n# 5. generates dummy function\n# 6. generates other functions\n# 7. generates case list evaluation\n# 8. generates dispatch\n# 9. inserts menu at top\n# \npout="./test.sh"\n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\n#D echo "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; \n# \ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is menubot.sh, a tool for managing trantor\n## a web server designed to serve out Linux Format DVDs.\n## *** NOTE *** This program need not be run as root,\n## OPERATION\n## The syntax is:\n## - menubot.sh hlpdmy - Generates Helpb & dummy, \n## - menubot.sh parsmnu - parsmnu extracts functions ffile.shi and evaluators efile.shi\n## - menubot.sh smauf - Generate Standard and maybe somewhat usefull\n## - menubot.sh dispach - Generate dispatcher \n## - menubot.sh tada - Puts pieces together\n## - menubot.sh flink <prog> - Places program in path\n## - menubot.sh flunk <prog> - Removes program in path\n#\n## For structure information type "grep '^\s#\s*' menubot.sh"\n## (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n## This is released under GPL dbtsI\n##\n} # Test:\n#\n# *****Documentation Loop ends here the rest is function******\n#\n#* function dummy - Rename and fill stuff in between braces\nfunction dummy(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# uroot\n} # Test:\n#\nfunction hlpdmy(){\n#* function hlpdmy - Generates top of program and dummmy function\n#D \necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\necho "Start hlp"\nspause\nclear\ntarget="hlp.shi"\nif test -f $target; then\necho "killing old "$target\nrm -rf $target\nfi\n# \nString1="$(cat <<EOF\n#!/bin/bash\n# pflint \n# cdate\nversion=0.0 \n#\n#* function help - Help function for template basic help goes here\nfunction help(){\necho "This is the \s""$FUNCNAME"\s" function in "\s$0" version "\s$version; # uroot #debug \nclear\ncat tada.sh | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n#1 *****DOCUMENTATION*****\n#1 You get this when you put in the wrong number or type of arguments...\n#1 The name of this program is menubot.sh, a tool for \n#1 generating FED Visual Bash scripts.\n#1 *** NOTE *** This program need not be run as root,\n#1 OPERATION\n#1 The syntax is:\nEOF\n) "\necho "$String1" |tee -a $target\n#\nnow=`date` > /dev/null\nsed -i "s/cdate/$now/g" $target\nsed -i "s/\s#1/\s#\s#/g" $target\n# change the name better!!!\n# sed -i "s/'"$0"'/'"$target"'/g" $target\n#\nspause\n#\nclear\ntarget="dmy.shi"\nif test -f $target; then\necho "killing old "$target\nrm -rf $target\nfi\n#\nString2="$(cat <<EOF\n#1 For structure information type "grep '^\s#\s*' menubot.sh"\n#1 (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n#1 This is released under GPL dbtsI\n#1\n} # Test:\n#\n#\n#* function dummy - Rename and fill stuff in between braces\nfunction dummy(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test:\nEOF\n)"\necho "$String2" |tee -a $target \nsed -i "s/\s#1/\s#\s#/g" $target\nchmod +x $target\n#\n} # Test: hlpdmy\n#\n#\nfunction parsmnu(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#* function dummy - parsmnu extracts functions ffile.shi and evaluators efile.sh\n# uroot\n# get data begin loop\nffile="ffile.shi"\nefile="efile.shi"\n#D spause\nclear\ntarget=$ffile\nif test -f $target; then\necho "killing old "$target\nrm -rf $target\nfi\n# \nclear\ntarget=$efile\nif test -f $target; then\necho "killing old "$target\nrm -rf $target\nfi\n#\ncat test.mnu |grep "-" | tr -s " " |while read line; \ndo \nfname=$(echo $line | cut -d "-" -f 2 | tr -d " ") # ; echo $fname\nfdesc=$(echo $line | cut -d "-" -f 3) # ; echo $fdesc\n# This makes the function file\necho '#'|tee -a $ffile\necho 'function '$fname'(){' |tee -a $ffile\necho '#* function '$fname' - '$fdesc |tee -a $ffile\necho 'echo "This is the \s""$FUNCNAME"\s" function in "$0" version "$version ' |tee -a $ffile\necho 'echo "Insert function here!"'|tee -a $ffile\necho '} # Test:'|tee -a $ffile\necho '#'|tee -a $ffile\nspause\n# \n# This makes the evaluator file\necho 'if [ "$#" -eq "1" ] && [ "$1" = '$fname' ]; then ARGS="1"; fi' |tee -a $efile\ndone\necho 'if [ "$#" -eq "1" ] && [ "$1" = dummy ]; then ARGS="1"; fi' |tee -a $efile\n} # Test:\n#\n#\nfunction dispach(){\n#* function dispach - Writes out dispatch and termination glue\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# uroot\n#\nclear\ntarget="dispach.shi"\nif test -f $target; then\necho "killing old "$target\nrm -rf $target\nfi\n#\n# this is the DISPATCH...\ntarget="dispach.shi"\nARG=""\nDISPATCH="$(cat <<EOF\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n# this tests the evaluator...\n#D echo "Arg# = "\s$#" \s$1 = "\s$1" \s$2 = "\s$2" \s$3 = "\s$3" \s$ARGS = "\s$ARGS ;spause \n#D echo \s$#" "\s$var1" "\s$var2" "\s$var3" "\s$ARGS #debug \n#D echo "menubot.sh v"\s$version" starts" ;spause()\n#* Dispatcher Routine\n# typical cases, be careful to make your own...\ncase \s$ARGS in\n "0") clear; "help";; # got nothing, display help and go\n "1") \s$1 ;; # run the command\n "2") var2=\s$2; \s$1 ;; # run the command pass an argument\n "3") var3=\s$3; var2=\s$2; \s$1 ;; # run the command pass two arguments\n "4") var4=\s$4; var3=\s$3; var2=\s$2; \s$1 ;; # run the command pass three arguments\n "5") prompt=\s$2; \s$1 ;; # run the command with a different argument\n "6") time=\s$3; prompt=\s$2; \s$1 ;; # run the command with two different arguments\n "7") var3=\s$3; var2=\s$2; defvbl; \s$1 ;; # run the command and default variables\n "8") var2=\s$2; \s$1 ;; # run the command and settle variables\n "9") var3=\s$3; var2=\s$2; \s$1 ;; # run the command and settle variables\n *) clear; "help"; exit 1;; # got nothing, display help and go\n # *) clear; cat \s$0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. TEST: ?fill in test?\n#\n# echo " "; echo "On "\s$(date +%F\s %r) \s$0" version "\s$version" stops"\n#debug echo "That's all folks!!"\n#\n#* restore environment cd "\s$S"\n#\nEOF\n)"\necho "$DISPATCH" |tee -a $target\n# sed -i "s/banana/'"$ARG"'/g" $target\n# sed -i "s/banana/"'$ARGS'"/g" $target\n# sed -i "s/pear/"'$1'"/g" $target\n} # Test: dispach\n#\n#\nfunction tada(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#* function - tada - Puts pieces together\n# uroot\nclear\ntarget="tada.sh"\nif test -f $target; then\necho "killing old "$target\nrm -rf $target\nfi\n#\n# cat hlp.shi test.mnu dmy.shi ffile.shi smauf.shi check.shi efile.shi dispach.shi > tada.sh\ncat hlp.shi test.mnu dmy.shi ffile.shi smauf.shi efile.shi dispach.shi > tada.sh\nchmod +x tada.sh\nspause\n} # Test:\n#\n#\nfunction smauf(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#* function smauf - builds the smauf.shi file\n# uroot\nclear\ntarget="smauf.shi"\nif test -f $target; then\necho "killing old "$target\nrm -rf $target\nfi\n#\nSMAUF="$(cat <<EOF\n#*####################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW################################\n#\nfunction flink(){\n#* function flink - Adds one symbolic link between named program\n# and the profiled directory /home/user/bin\n# uroot\necho "This is the \s""\s$FUNCNAME"\s" function in "\s$0" version "\s$version \n#Debug\nFNAME=\s$var2; \n#D echo \s$FNAME\necho "Have found " \s$FNAME"!"\nSTDIR=\s$(pwd) \necho "creating target... "\n#D \necho \s$STDIR\n#D \necho \s$HOME\nTARGET=\s$HOME"/bin/"\s$FNAME\necho \s$TARGET\nspause\n# if [ -e "\s$TARGET" ]; echo "Already Linked"; fi\nif test -f \s$TARGET ; then echo "Link Exists flunk first!"; return; fi\n#\nspause\ncd \s$STDIR\n# echo \s$PWD \necho \s$FNAME" should be in the home path"\n# echo " "\s$PATH\necho \s$PATH| tr ":" "\sn" |while read line; do echo " - "\s$line; done # Very Cool\necho "Above is the be overall path for "\s$USER\n#D ls -alt \s$HMDIRs\necho "linking now"\nSOURCE=\s$PWD"/"\s$FNAME\n#D echo "Source "\s$SOURCE\n#D echo "Target "\s$TARGET\necho "What happens here is this:"\n#D echo "ln -s " \s$SOURCE \s$TARGET \nln -s \s$SOURCE \s$TARGET \n# ls -alt \s$TARGET\necho "Output of the 'which "\s$FNAME"' command shows linked to the path "\nwhich \s$FNAME\n# \n} # Test: menubot.sh flink <filename>\n#\nfunction flunk(){\n#* function flunk - Un-Symlinks [file] & [file].sh into \s$PATH\necho "This is the \s""\s$FUNCNAME"\s" function in "\s$0" version "\s$version #debug\n#D echo \s$var2\nFNAME=\s$var2\necho "Is this the right name to unlink? "\s$FNAME\nTARGET=\s$HOME"/bin/"\s$FNAME\n# TARGET=\s$(which \s$FNAME)if [ "\s$#" -eq "2" ] && [ "\s$1" = "geneval" ]; then ARGS="2"; fi\necho "Have found a link to "\necho \s$TARGET \n#\necho "Do This?"\necho "rm "\s$TARGET\nspause\nrm \s$TARGET\n} # Test: menubot.sh flunk <filename>\n#\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "\s$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2\nfi\n} # Test:~flint/bin/menubot.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t \s$pt -p "\s$*" ans\n read -p "Hit enter to continue..." ans\n echo \s$ans\n}\n#\nEOF\n)"\necho "$SMAUF" |tee -a $target\n} # Test: dispach\n#\n#\n#*####################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW################################\n#\nfunction flink(){\n#* function flink - Adds one symbolic link between named program\n# and the profiled directory /home/user/bin\n# uroot\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version \n#Debug\nFNAME=$var2; \n#D \necho $FNAME\nspause\necho "Have found " $FNAME"!"\nSTDIR=$(pwd) \necho "creating target... "\n#D \necho $STDIR\n#D \necho $HOME\nTARGET=$HOME"/bin/"$FNAME\necho $TARGET\nspause\n# if [ -e "$TARGET" ]; echo "Already Linked"; fi\nif test -f $TARGET ; then echo "Link Exists flunk first!"; return; fi\n#\ncd $STDIR\n# echo $PWD \necho $FNAME" should be in the home path"\n# echo " "$PATH\necho $PATH| tr ":" "\sn" |while read line; do echo " - "$line; done # Very Cool\necho "Above is the be overall path for "$USER\n#D ls -alt $HMDIRs\necho "linking now"\nSOURCE=$PWD"/"$FNAME\n# echo "Source "$SOURCE\n# echo "Target "$TARGET\necho "What happens here is this:"\necho "ln -s " $SOURCE $TARGET \nln -s $SOURCE $TARGET \n# ls -alt $TARGET\necho "Output of the 'which "$FNAME"' command shows linked to the path "\nwhich $FNAME\n# \n} # Test: menubot.sh flink <filename>\n#\nfunction flunk(){\n#* function flunk - Un-Symlinks [file] & [file].sh into $PATH\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#D echo $var2\nFNAME=$var2\necho "Is this the right name to unlink? "$FNAME\nTARGET=$HOME"/bin/"$FNAME\n# TARGET=$(which $FNAME)if [ "$#" -eq "2" ] && [ "$1" = "geneval" ]; then ARGS="2"; fi\necho "Have found a link to "\necho $TARGET \n#\necho "Do This?"\necho "rm "$TARGET\nspause\nrm $TARGET\n} # Test: menubot.sh flunk <filename>\n#\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2\nfi\n} # Test:~flint/bin/menubot.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n#D include\n#\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n#d ARGS=$# # carries the number of args into the functions...\n#d echo "Arg# = "$#" \s$1 = "$1" \s$2 = "$2" \s$3 = "$3" \s$ARGS = "$ARGS ;spause \n#\nif [ "$#" -eq "1" ] && [ "$1" = "hlpdmy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "parsmnu" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "pulfun" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "smauf" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "tada" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dispach" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "flink" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "flunk" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="0"; fi\nif [ "$#" -eq "0" ]; then ARGS="0"; fi\n#\n# this tests the evaluator...\n#D echo "Arg# = "$#" \s$1 = "$1" \s$2 = "$2" \s$3 = "$3" \s$ARGS = "$ARGS ;spause \n#D echo $#" "$var1" "$var2" "$var3" "$ARGS #debug \n#D echo "menubot.sh v"$version" starts" ;spause()\n#* Dispatcher Routine\n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; "help";; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command pass an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command pass two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command pass three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") var3=$3; var2=$2; defvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; "help"; exit 1;; # got nothing, display help and go\n # *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. TEST: ?fill in test?\n#\n# echo " "; echo "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug echo "That's all folks!!"\n#\n#* restore environment cd "$S"\n\n}}}
Type the text for '3 November 2016'\n\nMy great ambition is to allow the vi editor to ''fold'' based upon the proper shebang\n\n
Type the text for '23 November 2016'\n\n* menubot.sh - builds visual bash "sh" files from visual bash "shi" include files\n* bzinga.sh - builds a bash/zenity gui that communicates with Visual Bash through the use of the Graphical Secure Dispatch\n* Need to reorganize all of the visual bash functions into functional includes... Possible include\nfiles are:\n** [[ianda.shi]] - Identification and Authorization\n** [[dvdusb.shi]] - DVD/USB utilities\n** [[dvdcd.shi]] - CD/DVD utilities\n** [[sanity.shi]] - System sanity tests\n** [[maint.shi]] - Maintenance includes\n** [[ops.shi]] - Operational includes\n** [[dev.shi]] - Development includes\n** [[sphinx.shi]] - Sphinx generator includes\n** [[tiddle.shi]] - Tiddle includes...\n\n
Type the text for '9 January 2017'\n\nNot perfectly compliant with visualbash specification, but useful none-the-less\n\n{{{\n#!/bin/bash\n# pflint 2017-01-09 11:28:49 \n# turns camera on or off\n#\n##\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; uroot #debug \ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is vonf.sh, a tiddle based proposal generator.\n## This is released under GPL I\n## The syntax is:\n## - vonf.sh off - Turns usb camera off - if unused. \n## - vonf.sh on - Turns usb camera off - if not blacklisted. \n## - vonf.sh test - Tests if camera works. \n## - vonf.sh stopcam - blacklists uvcvideo \n## - vonf.sh startcam - un-blacklists uvcvideo \n## in all of these, Output is delivered to the screen...\n## *** NOTE *** These commands need to be run as root!\n##\n## For structure information type "grep '^\s#\s*' vonf.sh"\n## :^)\n## (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n##\n# *****Documentation Loop ends here the rest is function******\n#\n} # Test: vonf.sh\n#\n#* function dummy - Rename and fill stuff in between braces\nfunction dummy(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test:\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script does not need to run as root but that's OK as you are not root" 1>&2\nfi\n} # Test:~flint/bin/chello.sh uroot\n#\n#\n#* function stopcam - blacklists driver from /etc/modprobe.d\nfunction stopcam(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\ncp /etc/modprobe.d/blacklist_video_off.conf /etc/modprobe.d/blacklist.conf \necho "Camera driver uvcvideo now blacklisted, reboot now" \n} # Test:\n#\n#* function startcam - unblaclists driver in /etc/modprobe.d\nfunction startcam(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\ncp /etc/modprobe.d/blacklist_video_on.conf /etc/modprobe.d/blacklist.conf \necho "Camera driver uvcvideo now un-blacklisted, reboot now" \nuroot\n} # Test:\n#\n# echo $1\ncase "$1" in\n "on" ) echo "turn camera on"; modprobe uvcvideo ;;\n "off" ) echo "turn camera off"; modprobe -r uvcvideo ;;\n "stopcam" ) echo "turn camera off"; stopcam ;;\n "startcam" ) echo "turn camera off"; startcam ;;\n "test" ) echo "testing camera camera"; cheese &;;\n * ) echo "Signal number $1 is not processed"; help ;;\nesac\n# if $1 \n# modprobe uvcvideo\n# modprobe -r uvcvideo\n# modprobe uvcvideo\n# cheese\n\n\n}}}
'20 January 2017'\n\n* [[Vm Workshop Columbus, OH |http://www.vmworkshop.org/2017.shtml]]\n* [[LinuxCon China|http://events.linuxfoundation.org/events/linuxcon-containercon-cloudopen-china/program/cfp?utm_source=event-promo&utm_campaign=LC3-17&utm_medium=email]]\n
* [[The github repo|https://github.com/flintiii/VisualBash]]\n\n '30 January 2017'\n\nI will likely be needing to reorganize all of the visual bash functions into functional includes... Possible\ninclude files are:\n\n* ianda.shi - Identification and Authorization\n* dvdusb.shi - DVD/USB utilities\n* [[sanity.shi|SanityScript]] - System sanity tests\n* maint.shi - Maintenance includes\n* ops.shi - Operational includes\n* dev.shi - Development includes\n* sphinx.shi - Sphinx generator includes\n* tiddle.shi - Tiddle includes...\n* gui.shi - Graphical User Interface using [[bzinga|http://bzinga.net/]]\n\nI would like these to be available on github.\n\nCould 2017 may be the year of VisualBash?\nWe have a presentation on the subject due in June...\n
'30 January 2017'\n\nThe problem with Visual Bash is that all variables are global. Thus you need to always be aware as to what variables you are playing with locally in a function as to not effect variables beyond the current function. Several ways out include:\n\n# Establish a list of local variables.\n# Establish a list of global variables.\n# Write a Visual Bash script that checks for variable conflict.\n# Be very, very careful and test a whole bunch\n
'31 January 2017'\n\nThis is the prototype ctg.sh. I really fails in the spirit of visual bash, and needs thought and refactoring.\n{{{\n#!/bin/bash\n# SOURCE: https://ubuntuforums.org/showthread.php?t=1999502\n#\n#\n#* function dummy - Rename and fill stuff in between braces\nfunction dummy(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n} # Test:\n#\n#* function isos - list mount or unmount isos\nfunction isos(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\nread -d '' String <<"EOF"\nTRANTOR ISO IMAGES CONTROL\nSelect the function to be used:\n(keyboard ↑ ↓ Arrow(s) + space)\nEOF\n#\nopt1="list - List the current ISO images on system"\nopt2="unmount - Unmount ISO images currently mounted"\nopt3="mount <mamifest.iso> - Mount default list or pick"\n#\nint=$(zenity --height=275 --width=575 --list --radiolist --text="$String" --column 'Select...' \s\n --column 'Function Name' \s\n FALSE "$opt1" \s\n FALSE "$opt2" \s\n FALSE "$opt3" \s\n 2>/dev/null)\n#\n#D \necho "Chosen option: "$int\n} # Test:\n\n#* function web - web on off yo-yo\nfunction web(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\nread -d '' String <<"EOF"\nTRANTOR WEB CONTROL\nSelect the function to be used:\n(keyboard ↑ ↓ Arrow(s) + space)\nEOF\n#\nopt1="status - Return Web Status"\nopt2="off - Turn Web off"\nopt3="on - Turn Web Server on"\nopt4="yo-yo - Restart Web Server"\n#\n# int=`zenity --height=275 --list --radiolist --text="$String" --column 'Select...' --column 'Function Name' FALSE "$opt1" FALSE "$opt2" FALSE "$opt3" FALSE "$opt4" FALSE "$opt5" FALSE "$opt6"`\n#\nint=$(zenity --height=275 --width=275 --list --radiolist --text="$String" --column 'Select...' \s\n --column 'Function Name' \s\n FALSE "$opt1" \s\n FALSE "$opt2" \s\n FALSE "$opt3" \s\n FALSE "$opt4" \s\n 2>/dev/null)\n#\n#D \necho "Chosen option: "$int\n} # Test:\n#\n#\n#* function mainm - This is the main menu\nfunction mainm(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nread -d '' String <<"EOF"\nTRANTOR OPERATIONS\nSelect the function to be used:\n(keyboard ↑ ↓ Arrow(s) + space)\nEOF\n#\nread -d '' opt4 <<"EOF"\nisos [ list unmount mount [<FILENAME>] ] \nmounts unmounts or lists iso images in filesystem"\nEOF\n#\nopt1="diriso - Lists DVD images"\nopt2="option with spaces"\nopt3="web [on off yo-yo] - Turn Web Server on, off, restart"\n# opt4="isos [mount [<FILENAME>] unmount list] mounts unmounts or lists iso images in filesystem"\nopt5="ctrantor.sh [dvd usb] <ISO NAME> - makes dvd or usb"\nopt6="option 6"\n#\n# int=`zenity --height=275 --list --radiolist --text="$String" --column 'Select...' --column 'Function Name' FALSE "$opt1" FALSE "$opt2" FALSE "$opt3" FALSE "$opt4" FALSE "$opt5" FALSE "$opt6"`\n#\nint=$(zenity --height=275 --width=532 --list --radiolist \s\n --text="$String" \s\n --column 'Select...' \s\n --column 'Function Name' \s\n FALSE "$opt1" \s\n FALSE "$opt2" \s\n FALSE "$opt3" \s\n FALSE "$opt4" \s\n FALSE "$opt5" \s\n FALSE "$opt6" \s\n 2>/dev/null)\n#D echo "Chosen option: "$int\n} # Test:\n#\n# dummy\n# \nmainm; ARGS=$(echo $int | tr -s " " |cut -d " " -f 1)\n# web\ncase "$ARGS" in\n "0") clear; "help";; # got nothing, display help and go\n "web") web ;; # run the command web\n "isos") isos ;; # run the command isos\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command pass an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command pass two arguments\n *) clear; "help"; exit 1;; # got nothing, display help and go\n # *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. To TEST:\n}}}
'2 February 2017'\n\nAUDIENCE:\nThis presentation is targeted towards:\n1. zVM system operators who need to have a ready collection of zLinux command environment tools.\n2. Jenkins, Puppet, Chef or OpenStack Juju Charm developers who are interested in what is now a cross platform language.\n3. Linux, Windows or Mac system users or developers interested in a way to perform tasks\n4. Folks interested in general systems operations.\n
Graphic Secure Dispatch (GSD) is a cross platform way to run all the shell scripts.\n\n* For Windows [[plink]]-[[pyzenity]]\n* For Linux [[ssh]]-[[pyzenity]]\n\nGSD is comprised of these three elements:\n# The [[bzinga.net|http://bzinga.net/]] system allows for a graphic interface to a \n# command line environment, which processes via a [[VisualBash|http://visualbash.org]] the command or charm. \n# The result is dispatched with assurance to a particular service platform via [[SSH|https://en.wikipedia.org/wiki/Secure_Shell]] \n\nThe [[GSD|http://docbox.flint.com:8081/bzinga.net#GraphicalSecureDispatch]] element is intended to control:\n* Windows (via plink.exe)\n* Linux \n* Mainframes (via IUCV over SSH)\n* Internet Of Things (via ssh)\n\n\nCould this have anything to do with the [[Akka Project?|http://akka.io/]]\n
Graphic Secure Dispatch (GSD) is a cross platform way to run all the shell scripts.\n\n* For Windows [[plink]]-[[pyzenity]]\n* For Linux [[ssh]]-[[pyzenity]]\n\nGSD is comprised of these three elements:\n# The [[bzinga.net|http://bzinga.net/]] system allows for a graphic interface to a \n# command line environment, which processes via a [[VisualBash|http://visualbash.org]] the command or charm. \n# The result is dispatched with assurance to a particular service platform via [[SSH|https://en.wikipedia.org/wiki/Secure_Shell]] \n\nThe [[GSD|http://docbox.flint.com:8081/bzinga.net#GraphicalSecureDispatch]] element is intended to control:\n* Windows (via plink.exe)\n* Linux \n* Mainframes (via IUCV over SSH)\n* Internet Of Things (via ssh)\n\n\nCould this have anything to do with the [[Akka Project?|http://akka.io/]]\n
'17 February 2017'\n\n|!Reference HTML|! Description|\n|[[Stackoverflow Hoto include other scripts|http://stackoverflow.com/questions/192292/bash-how-best-to-include-other-scripts]]||\n|[[Stackoverflow Hoto include other scripts|http://stackoverflow.com/questions/192292/bash-how-best-to-include-other-scripts/12694189#12694189]]||\n|[[Stackoverflow Hoto include file in a bash shell|http://stackoverflow.com/questions/10823635/how-to-include-file-in-a-bash-shell-script]]||\n|[[Stackoverflow Hoto include a file containing bariables|http://stackoverflow.com/questions/17530141/how-to-include-a-file-containing-variables-in-a-shell-script]]|This is particularly good|\n
Type the text for '18 February 2017'\n\nCould the [[make|https://www.gnu.org/software/make/manual/make.html]] system prove useful?\n\nNote KJColes warning below:\n> Well, technically "GNU make" Makefiles, as there is a note in\n> https://www.gnu.org/software/make/manual/make.html\n> regarding incompatibilities with POSIX make.
Type the text for '7 March 2017\n\n[[A GUI Generator ?|http://brain.netlinux.org.uk/VisualBash.html]]
The text for '13 March 2017'\n\nVISUAL BASH\nGSD amd the bzinga project:\nAs mentioned above, I dusted off the Bash-Zenity project with the thought of \nadding this to trantor as a GUI based control framework. So far it is \ninteresting, as GUIs now haunt my dreams looking for the best way to configure \nthings...\n\nhttp://bzinga.net/\n\nI continue to meditate on the discussion DTG and I had last month about \nhow GUI code needs to be non-blocked. So, the approach I continue to think \nabout for now involves putting the GUI code in includes that get included \nonly when you need them. The Visual Bash framework really works. Will this \nwork for adding a GUI with bzinga? And how does BNF fit into this? \nProgress is slow based upon the trantor work.\n\nBut the line between bzinga and the Menubot function gets fuzzier all the time, \nmaybe the menubot program has a way of generating coefficients that the GUI \nsystem can use to autogenerate GUI menues. Maybe using BackusโNaur form (BNF \nor Railroad Notation). After some playing around with zenity, I am more \nconvinced that the use of zenity for a gui interface, (see the Bash Zenity \nIntegration page: http://bzinga.net/ :^) is not a bad plan. Beyond this we \nreally need to clean up the VisualBash page. Now that we have the "include" \nfunction that is similar to the one in python (C and a lota other languages :^) \nwe need to git this.\n\nhttp://docbox.flint.com:8081/visual.bash#ImportingFunctionBlocks\n\nThe Visual Bash git page needs to be organized. We need to reorganize all of \nthe visual bash functions into functional includes. Possible include files \nare:\n\n- ianda.shi - Identification and Authorization\n- dvdusb.shi - DVD/USB utilities\n- sanity.shi - System sanity tests\n- maint.shi - Maintenance includes\n- ops.shi - Operational includes\n- dev.shi - Development includes\n- sphinx.shi - Sphinx generator includes\n- tiddle.shi - Tiddle includes...\n- gui.shi - Graphical User Interface using bzinga\n- movingday - Tar up what you need.\n\nThe problem is that I cannot resist the challenge of the GUI menu generator \n"menubot.sh" that will allow you to test stub your "shi" files with a crude but \nworking "sh". Who knows where we go from there? Again, the Design questions \nremain:\n\n- Do individual functions call for particular software packages\n by adding their local requirements to a file or memory variable?\n- Should the sanity program try to md5 sum the components?\n- Can the sanity program help resolve name-space issues?\n\nCould 2017 may be the year of VisualBash? We have a presentation on the subject \ndue in June, and I may even begin to treat the presentation as a project. \nIt has been occupying my mind quite a bit.\n\n\n
Type the text for '12 April 2017'\n\nhttps://github.com/Microsoft/BashOnWindows/issues/880#issuecomment-293490579
How are we going to build the basic operating components of OpenStack, JuJu "charms"? In order to do this, could a framework be developed that would allow for extensive use of bash as the go to general purpose information management system automation tool?\n\nOur recent development tool choices seem to indicate that If you don't have a GUI in this day and age you are lost...\n\nIn a bygone day, for instance, the program QBASIC had a framework that allowed you to conveniently access individual subroutines. The big ticket was the editor. Is QBASIC essentially the first Integrated Development Environment, and can we get back to it's essence?.\n \nVisual Basic and it's successors all seem to all be based upon the idea of an IDE. This is carried over even as far as the Arduino Sketch. Is the GUI IDE really the basis of a good framework?\n\nThis presentation will explore the question: \nWhy not build a CLI framework around BASH?\n\nThe first step in this exposition shall be to orient the audience to bash. Most users that think of BASH think of it as a prompt and a command line. That is BASH in interactive mode. BASH almost effortlessly flows into non-interactive mode, and when executing shell scripts. Is where we shall an overview of a painfully simple yet pervasive structure. This shall followed by a discussion of shell qualifiers (shebangs), all of this subject to change, but benefits from standardization.\n\nThe Visual Bash framework to date insists that each program contain three elements:\n1. A menu area describing how to use keywords,\n2. An argument counting parser, and finally\n3. A case statement that routes supplied input to specific functions.\nAll of the rest is functions.\n\nDiscussion of Visual Bash Structural Details:\nVisual Bash is comprised of the following sections:\n Savings\n Help Message\n Dummy Function\n Actual Functions\n Useful Functions\n Parser\n Restoration\n\nImplementing the Visual Bash include function expansion is possible. We shall discuss the weaknesses of this environment such as the namespace problem, and other bash gotchas\n\nFinally we shall outline which User Interface (UI) could and should be the method of choice; sketch, whiptail, emacs... or our special guest star Zenity.\n\nWith luck we shall demonstrate Visual Bash using the Bash/Zenity integration (bzinga) device as a Grapic Secure Dispatch (GSD) tool currently of of choice.\n\nThat's it.
'21 April 2017' Copied over from trantor\n\nType the text for '14 April 2017'\n\n\n{{{\n#!/bin/bash\n# 2017-01-12 10:31:44 \n# pflint\n# just tests sane...\n#\n#* check location of vital files and programs, sanity check\nfunction sane(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nrm -rf need > /dev/null\nfor prog in sphinx-common sphinx-doc python-sphinx git pv apache2 #D banana # programs you need put here\ndo\n # echo $prog\n # Better SOURCE:https://www.cyberciti.biz/faq/find-out-if-package-is-installed-in-linux/\n answer=$(echo $(dpkg-query -W -f='${Status} ${Version}\sn' $prog)| cut -d " " -f 3)\n # echo $answer \n if [ "$answer" != "installed" ];\n then\n echo $prog >> need\n #debug echo "Type \s"sudo apt-get install $prog\s" to fix this."\n #debug spause\n # exit 0\n fi\ndone\n#D clear\necho "Welcome to $0!"\n# uroot\necho "Missing programs:"\n if [ -f need ];\n then\n echo " This program needs the following program(s) to be installed on this system."\n cat need |while read line; do echo -e \s\st" - " $line; done\n if [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2\n echo "You want them installed if you are root they will install"\n echo "Leaving this function without installing anything"\n exit\n fi\n spause\n cat need |while read line; do \n echo "apt-get --yes install $line"\n apt-get --yes install $line \n done\n #D \n rm -rf need\n exit 0 # breaks you out of loop...\n else\n echo " * None * Looks like the pot's right, lets play!"\n fi\n#\necho "end of check"\n} # Test: ctrantor.sh sane\n#\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2\nfi\n} # Test:~flint/bin/ctrantor.sh uroot\n#\nsane\n#f \necho "On "$(date +%F\s %r) $0" version "$version" stops"\n}}}
'21 April 2017'\n\nGNU bash, version 4.2.37(1)-release (i686-pc-linux-gnu)\nThese shell commands are defined internally. Type `help' to see this list.\nType `help name' to find out more about the function `name'.\nUse `info bash' to find out more about the shell in general.\nUse `man -k' or `info' to find out more about commands not in this list.\n\nA star (*) next to a name means that the command is disabled.\n\n job_spec [&] history [-c] [-d offset] [n] or hist>\n (( expression )) if COMMANDS; then COMMANDS; [ elif C>\n . filename [arguments] jobs [-lnprs] [jobspec ...] or jobs >\n : kill [-s sigspec | -n signum | -sigs>\n [ arg... ] let arg [arg ...]\n [[ expression ]] local [option] name[=value] ...\n alias [-p] [name[=value] ... ] logout [n]\n bg [job_spec ...] mapfile [-n count] [-O origin] [-s c>\n bind [-lpvsPVS] [-m keymap] [-f filen> popd [-n] [+N | -N]\n break [n] printf [-v var] format [arguments]\n builtin [shell-builtin [arg ...]] pushd [-n] [+N | -N | dir]\n caller [expr] pwd [-LP]\n case WORD in [PATTERN [| PATTERN]...)> read [-ers] [-a array] [-d delim] [->\n cd [-L|[-P [-e]]] [dir] readarray [-n count] [-O origin] [-s>\n command [-pVv] command [arg ...] readonly [-aAf] [name[=value] ...] o>\n compgen [-abcdefgjksuv] [-o option] > return [n]\n complete [-abcdefgjksuv] [-pr] [-DE] > select NAME [in WORDS ... ;] do COMM>\n compopt [-o|+o option] [-DE] [name ..> set [-abefhkmnptuvxBCHP] [-o option->\n continue [n] shift [n]\n coproc [NAME] command [redirections] shopt [-pqsu] [-o] [optname ...]\n declare [-aAfFgilrtux] [-p] [name[=va> source filename [arguments]\n dirs [-clpv] [+N] [-N] suspend [-f]\n disown [-h] [-ar] [jobspec ...] test [expr]\n echo [-neE] [arg ...] time [-p] pipeline\n enable [-a] [-dnps] [-f filename] [na> times\n eval [arg ...] trap [-lp] [[arg] signal_spec ...]\n exec [-cl] [-a name] [command [argume> true\n exit [n] type [-afptP] name [name ...]\n export [-fn] [name[=value] ...] or ex> typeset [-aAfFgilrtux] [-p] name[=va>\n false ulimit [-SHacdefilmnpqrstuvx] [limit>\n fc [-e ename] [-lnr] [first] [last] o> umask [-p] [-S] [mode]\n fg [job_spec] unalias [-a] name [name ...]\n for NAME [in WORDS ... ] ; do COMMAND> unset [-f] [-v] [name ...]\n for (( exp1; exp2; exp3 )); do COMMAN> until COMMANDS; do COMMANDS; done\n function name { COMMANDS ; } or name > variables - Names and meanings of so>\n getopts optstring name [arg] wait [id]\n hash [-lr] [-p pathname] [-dt] [name > while COMMANDS; do COMMANDS; done\n help [-dms] [pattern ...] { COMMANDS ; }\n
'27 April 2017'\n\nBy Kevin Cole\n\n{{{\n#!/bin/bash\n#\n# finddups.sh\n# Written by Kevin Cole <kevin.cole@novawebdevelopment.org> 2017.04.26\n#\n# This generates a list of files with duplicate SHA1 checksums\n#\n\nif [[ -e SHA1SUMS ]]\nthen\n rm SHA1SUMS\nfi\n\ntouch SHA1SUMS\nfind . -type f -print0 | xargs -0 sha1sum >> SHA1SUMS\nsort SHA1SUMS > SHA2SUMS\nmv SHA2SUMS SHA1SUMS\ncut -d " " -f 1 SHA1SUMS | uniq -d > dups\ngrep -F -f dups SHA1SUMS > fixus\n\n}}}
Type the text for '4 May 2017'\n\n{{{\nash="ashellname"; grep ^function $ash | cut -d " " -f 2 |while read line; do echo 'if [ "$#" -eq "1" ] && [ "$1" ="'$line'" ]; then ARGS="1"; fi'; done \n}}}\n\nAdding the comment to already written code"\n{{{\nash="zcommonfuncs.sh"; grep ^function -A1 $ash |grep -v function |grep -v ^-- |while read line; do targ=$(echo $line); goal=$(echo $line |sed 's/^# /#* /g' ); sed -i 's/'"$targ"'/'"$goal"'/' $ash 2>/dev/null; done \n}}}
Type the text for '8 May 2017'\n\n[[zoom|https://sourceforge.net/projects/system-zoom/files/?source=navbar]]
Type the text for '12 May 2017'\n\n* [[Awesome but opaque|https://pseudoscripter.wordpress.com/2012/10/16/whiptail-using-a-menu/]]\n* [[Tech Republic Article|http://www.techrepublic.com/blog/linux-and-open-source/how-to-use-whiptail-to-write-interactive-shell-scripts/]]
Type the text for '18 May 2017'\n\n!Is the answer Jupyter?\n\n|!Reference HTML|! Description|\n|[[reference|about:home]]||\n|[[nbviewer |http://nbviewer.jupyter.org/]]| nbviewer is worth it|\n|[[install.rst |https://github.com/jupyter/jupyter/blob/master/docs/source/install.rst]]||\n|[[Notebook Docs |http://jupyter-notebook.readthedocs.io/en/latest/]]||\n|[[Notebook |http://jupyter-notebook.readthedocs.io/en/latest/notebook.html]]||\n|[[Read the Docs |https://nbconvert.readthedocs.io/en/latest/]]||\n|[[Markdown |http://daringfireball.net/projects/markdown/syntax]]||\n|[[Project Jupyter |https://en.wikipedia.org/wiki/IPython#Project_Jupyter]]||\n\n\n[[BuildoutProject]]\n\n\n
Type the text for '21 May 2017'\n\n[[REPL|https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop]]\n\n''R''ead\n''E''evaluate\n''P''rint\n''L''oop\n\n
[[Beeware|\n\n\n[[Buildout|http://docs.buildout.org/en/latest]]\n\n[[Namoi|http://theheroines.blogspot.com/2014/11/interview-with-naomi-ceder.html]]\n\n[[Virtualenvironments Explained|https://www.youtube.com/watch?v=N5vscPTWKOk]]\n[Beeware|\n\n\n[[Buildout|docs.buildout.org/en/latest]]\n\n[[Namoi|http://theheroines.blogspot.com/2014/11/interview-with-naomi-ceder.html]]\n\nhovercraft restructured text to
2017-05-27\n\nianda.sh - Identification and Authorization Shell Script. Adaptable to become and include.\n\n{{{\n#!/bin/bash\n# This code generated by /home/flint/bin/menubot.sh\n# On Fri May 26 08:03:01 EDT 2017\n# pflint\nversion="0.004"\n# 2017-05-26 08:32:16 note mistake in menubot!\n# note this format allows for comments.#\n#* function help - Help function for template basic help goes here\nfunction help()\n{\n#D This is the ""$FUNCNAME"" function in "$0" version "$version; \nclear;\ncat $0 | grep '^## ' | sed -e 's/##//'\n## *****DOCUMENTATION*****'\n## You get this when you put in the wrong number or type of arguments...\n## This program was generated by menubot.sh which makes visualbash menus \n## The name of this program is "./ianda.sh"\n## Choose one of the following alternatives:\n## *** NOTE *** This program must not be run as root,\n## This is released under GPL dbtsI\n## The OPERATION syntax is:\n## - gkst <userid> challange user at secret tool level\n## - gkss <userid> challange user at secret set level\n## - sdst <userid> for userid set pass\n## - bldss <userid> build /tmp/ss using secret\n## :^)'\n## For structure information type "grep '^\s#\s*' ./ianda.sh"\n## (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n## This is released under GPL dbtsI\n}\n#* function dummy - Rename and fill stuff in between braces\nfunction dummy(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nnroot\n} # Test:\n#\n#* function gkss - challange user at secret set level \nfunction gkss(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nnroot\nshowt\nuser=$var2\nread -p "Enter the password for the user \s"$user\s": " ans\nif [ "$ans" = "$pass" ]; \nthen\n echo "good"\nelse\n echo "bad"\nfi\n} # Test:\n#\n#\n#* function gkst - challange user at secret set level \nfunction gkst(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nnroot\n#\nuser=$var2\nread -p "Enter the password for the user \s"$user\s": " ans\n#\npass=$(secret-tool lookup zope $user)\necho $pass\nif [ "$ans" = "$pass" ]; \nthen\n echo "good"\nelse\n echo "bad"\nfi\n} # Test:\n#\n#* function showt - shows the /tmp/ss you are currently working on\nfunction showt(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# device="/dev/stdout"\ndevice="/dev/null"\nIFS=$'\sn' ss=($(cat /tmp/ss))\n# [[ ${ss[1]} = $name ]] && echo "${a[$i]}"\ntiddleurl=${ss[0]};\nuid=${ss[1]};\npass=${ss[2]}\nproj=${ss[3]}\n#\necho -e " TiddleURL is\st"$tiddleurl > $device \necho -e " UID is \st"$uid > $device\necho -e " PASS is \st"$pass > $device\necho -e " PROJECT is \st"$label > $device\n#\n#D spause\n} # Test: ./chello.sh showt\n#\n#* function sdst - set a password with the secret-tool\nfunction sdst(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# As a user (not root) use this command to store a password "secret-tool store --label="zope access" user <userid>"\n# secret-tool store --label="zope access" user <userid>\n# secret-tool store --label="zope access" zope the\n#D \nnroot\nuser=$var2\nsecret-tool store --label="$label" zope $user\n} # Test:\n#\nfunction bldss(){\n#* function bldss - uses secret-store to gain password\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nnroot\nrm -rf /tmp/ss\n# https://askubuntu.com/questions/262698/how-do-i-get-passwords-from-the-keyring-in-the-terminal-for-usage-in-scripts/919103#919103\n# As a user (not root) use this command to store a password "secret-tool store --label="zope access" user <userid>"\n#D tiddleurl=$var2;\n#D \nuser=$var2\necho $user\n# pass=$(secret-tool lookup user $user)\npass=$(secret-tool lookup zope $user)\necho $pass\n#\necho -e " TiddleURL is\st"$tiddleurl \necho -e " User is \st"$user\necho -e " PASS is \st"$pass\n#\n#d spause\n#\n# stick the relevant secrets in /tmp/ss\ntouch /tmp/ss\necho $tiddleurl >> /tmp/ss\necho $user >> /tmp/ss\necho $pass >> /tmp/ss\necho "/tmp/ss contains";cat /tmp/ss\n\nif [ "$pass" ]; then\n echo -n "ss is in /tmp/ss"\nelse\n echo "password is not good"\n rm -rf /tmp/ss\n #d spause\nfi\n} # Test bldss tiddleurl the\n#\n# # This is the "gensamuf" function in /home/flint/bin/menubot.sh version 0.7\n######################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#* function nroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2\nfi\n} # Test:~flint/bin/menubot.sh uroot\n#\nfunction nroot(){\n#* function nroot - Only non root can run script\n# echo "Only non root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script must not be run as root and that's OK as you are not root" 1>&2\nfi\n} # Test:~flint/bin/mtoc.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n#D \ntiddleurl="Blank"\n#D \nlabel="zope access"\n#D user="the" # right pass\n#D user="banana" # wrong pass\n#D sdst\n#D bldss\n#\nif [ "$#" -eq "2" ] && [ "$1" = "gkst" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "gkss" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "sdst" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "bldss" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "showt" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="1"; fi\nif [ "$#" -eq "0" ]; then ARGS="0"; fi\n# This is the "gendisp" function in /home/flint/bin/menubot.sh version 0.7\n# DISPATCHER ROUTINE\n# typical cases, be careful to make your own...\n# echo "Arg# = "$#" $1 = "$1" $2 = "$2" $3 = "$3" $ARGS = "$ARGS ;spause \ncase "$ARGS" in\n "0") clear; "help";; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command pass an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command pass two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command pass three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") defvbl; $1 ;; # run the command and default variables\n "8") var2=$2; var3= $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; "help"; exit 1;; # got nothing, display help and go\n # *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. To TEST:\n#\n}}}
Revised '26 May 2017'\n\ncsv2tdl.sh\n\n{{{\n#!/bin/bash\n# pflint 2017-05-24 08:35:54 \n# turns csv travel document into a tiddle\n#\nversion="0.04"\n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; # uroot #debug \ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is csv2tdl.sh, a tiddle based proposal generator.\n## This is released under GPL I\n## The syntax is:\n## - csv2tdl.sh doit <filename.csv> - xls file to tiddle table with "tdl" ext. \n## - csv2tdl.sh transmf <filename.xls> converts and then sends the file with \n## - a tdl extention to the tiddle \n## - csv2tdl.sh showt - Turns csv file into a tiddle table. \n## - csv2tdl.sh bldss <filename.tdl> - builds secret store \n## Output is delivered to the screen unless specified.\n## *** NOTE *** These commands need not be run as root!\n##\n## For structure information type "grep '^\s#\s*' csv2tdl.sh"\n## :^)\n## (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n##\n# *****Documentation Loop ends here the rest is function******\n#\n} # Test: csv2tdl.sh\n#\n#* function dummy - Rename and fill stuff in between braces\nfunction dummy(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test:\n#\n#* function doit - Rename and fill stuff in between braces\nfunction doit(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# SOURCE https://stackoverflow.com/questions/10557360/convert-xlsx-to-csv-in-linux-command-line\n# echo $(echo $var2 |sed 's/\s.xls$//g' )\noutput=$(echo $var2 |sed 's/\s.xls$//g' )".csv"\n#D cat $output\ntiddle=$(echo $var2 |sed 's/\s.xls$//g' )".tdl"\nssconvert $var2 $output\n#D echo $output\ntoft=$(cat $output | head -1 |tr -d ",") \n# var2\necho $toft\nsed 's/"//g' $output | sed 's/,/|/g' | sed 's/^/|/g' | sed 's/$/|/g' > $tiddle\n} # Test:\n#\n#* function mktdl - creates an indivitual tiddle \nfunction mktdl(){\n#debug \nshowt > /dev/null\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\ntiddle=$toft\necho "Making "$tiddle\necho $tiddle > $proj.$tiddle\necho "curl -T proj.$tiddle http://$uid:$pass@$tiddleurl/$proj/tiddlers/$tiddle"\nspause\ncurl -T proj.$tiddle http://$uid:$pass@$tiddleurl/$proj/tiddlers/$tiddle\nrc=$?; if [[ $rc == 0 ]]; then echo "tiddle "$tiddle" made."; exit $rc; fi\necho $rc; \nspause\n} # Test:\n#\n#* function transmf - upload current file to tiddlewiki\nfunction transmf(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#D \ndevice="/dev/null" ;echo "out device is: /dev/null"\n#D device="/dev/stdout" ;echo "out device is: /dev/stdout"\necho "This is \s$var2: "$var2\ntiddladd=$(echo "http://docbox.flint.com:8081/travel/" | cut -d "/" -f 3); echo $tiddladd > $device\nproj=$(echo "http://docbox.flint.com:8081/travel/" | cut -d "/" -f 4); echo $proj > $device\ndoit\n#D spause\n#\nIFS=$'\sn' ss=($(cat /tmp/ss))\ntiddle=$(head -1 "self_2017-05-27.tdl" | tr -d "|"); echo "this is the tiddle: "$tiddle # > $device\ntail -n +3 "self_2017-05-27.tdl" > daout.tdl \ntiddleurl=${ss[0]};echo -e " TiddleURL is\st"$tiddleurl > $device \nuid=${ss[1]};echo -e " UID is \st"$uid > $device\npass=${ss[2]};echo -e " PASS is \st"$pass > $device\necho "curl -T daout.tdl $uid:$pass@$tiddladd/$proj/tiddlers/$tiddle";spause\ncurl -T daout.tdl $uid:$pass@$tiddladd/$proj/tiddlers/$tiddle\n} # Test:\n#\n#* function showt - shows the /tmp/ss you are currently working on\nfunction showt(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\ndevice="/dev/stdout"\n# device="/dev/null"\nIFS=$'\sn' ss=($(cat /tmp/ss))\n# [[ ${ss[1]} = $name ]] && echo "${a[$i]}"\ntiddleurl=${ss[0]};\nuid=${ss[1]};\npass=${ss[2]}\nproj=${ss[3]}\n#\necho -e " TiddleURL is\st"$tiddleurl > $device \necho -e " UID is \st"$uid > $device\necho -e " PASS is \st"$pass > $device\n# echo -e " PROJECT is \st"$label > $device\n#\n#D spause\n} # Test: ./csv3tdl.sh showt\n#\nfunction bldss(){\n#* function bldss - uses secret-store to gain password\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nnroot\nrm -rf /tmp/ss\n# https://askubuntu.com/questions/262698/how-do-i-get-passwords-from-the-keyring-in-the-terminal-for-usage-in-scripts/919103#919103\n# As a user (not root) use this command to store a password "secret-tool store --label="zope access" user <userid>"\n#D tiddleurl=$var2;\ntiddleurl="http://docbox.flint.com:8081/travel/"\n#D \nuser=$var2\necho $user\n# pass=$(secret-tool lookup user $user)\npass=$(secret-tool lookup zope $user)\necho $pass\n#\necho -e " TiddleURL is\st"$tiddleurl \necho -e " User is \st"$user\necho -e " PASS is \st"$pass\n#\n#d spause\n#\n# stick the relevant secrets in /tmp/ss\ntouch /tmp/ss\necho $tiddleurl >> /tmp/ss\necho $user >> /tmp/ss\necho $pass >> /tmp/ss\necho "/tmp/ss contains";cat /tmp/ss\n\nif [ "$pass" ]; then\n echo -n "ss is in /tmp/ss"\nelse\n echo "password is not good"\n rm -rf /tmp/ss\n #d spause\nfi\n} # Test: ./csv3tdl.sh tiddleurl the\n#\n#\n#\n######################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script does not need to run as root but that's OK as you are not root" 1>&2\nfi\n} # Test:~flint/bin/chello.sh uroot\n#\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\n#\n#* function nroot - Checks to see if you are root\nfunction nroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script does not run as root and you are not root" 1>&2\nfi\n} # Test:~flint/bin/menubot.sh uroot\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n# echo "csv2tdl.sh v"$version" starts"\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n# ARGS=$# # carries the number of args into the functions...\nif [ "$#" -eq "2" ] && [ "$1" = "bldss" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "doit" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "showt" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "block" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "transmf" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "bldss" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "check" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "install" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "remove" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "nroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#debug read -p $#" "$1" "$2" "$3" "$ARGS \n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; cat $0 | grep '^## ' | sed -e 's/##//'; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") defvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. To TEST:\n}}}
Type the text for '13 June 2017'\n\n!#1 SELF\nPresentation at [[South East Linux Fest|http://www.southeastlinuxfest.org/]] is [[here|http://docbox.flint.com/~flint/self/visual_bash_self_2017-06-11.pdf]] download as [[powerpoint|http://docbox.flint.com/~flint/self/visual_bash_self_2017-06-02.ppt]] as well...\n\n
\n> In these days of inappropriate politically incorrect name calling would you\n> see all those that don't master bash as bashtards?\n> \n
'2 July 2017'\n\n[[Ubiquitous Bash on github |https://github.com/mirage335/ubiquitous_bash]]\n\nJust stumbled onto the GitHub page of the HacDC Director At Large, Matt "mirage" Hines and found [["Ubiquitous Bash"|https://github.com/mirage335/ubiquitous_bash]]. Matt says:\n\nMore than a collection of functions, Ubiquitous Bash is a structure for gluing functionality into completely safe, portable application.\nExtensive, yet elegantly simple, mechanisms cover every startup/shutdown case, avoiding such things as file name collisions when multiple\ninstances are run. Additionally, Ubiquitous Bash recognizes parameters intended as calls to internal functions, allowing any script operations\nto be tested interactively from the command line. Because of this, Ubiquitous Bash fully supports recursively calling itself as a way to\nexecute its own internal functions in a completely isolated way.\n\n # Provides low level functions useful in many bash scripts.\n\n\nWhile we are at it. [[Command Line Fu|http://www.commandlinefu.com]]
,,rcps.sh,,\n'14 July 2017'\n\nStupid code for managing my resume...\n{{{\n#!/bin/bash\n# pflint 2017-01-09 11:28:49 \n# manages resume update\n#\n#\nversion="0.6"\n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; uroot #debug \ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is rcps.sh, a tiddle based proposal generator.\n## This is released under GPL I\n## The syntax is:\n## - rcps.sh c2htm <file.doc> -converts to html format \n## - rcps.sh c2pdf <file.doc> -converts to pdf format\n## - rcps.sh c2txt <file.doc> -converts to txt format\n## - rcps.sh tw9y <file.doc> -the whole nine yards \n## - converts doc file to pdf, txt & html. \n## - copies all files to "".[doc,pdf,txt,html]. \n## - backs up existing "".[doc,pdf,txt,html] files obe. \n## - uploads files to http://family.flint.com/flint. \n## - rcps.sh rename- rename resume files to upload names. \n## - rcps.sh dsply <file[doc,txt,pdf]> displays these three types\n## - rcps.sh upld - Uploads resume files to server. \n## in all of these, Output is delivered to the screen...\n## *** NOTE *** These commands need not be run as root!\n##\n## For structure information type "grep '^\s#\s*' rcps.sh"\n## :^)\n## (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n##\n# *****Documentation Loop ends here the rest is function******\n#\n} # Test: rcps.sh\n#\nfunction dummy(){\n#* function dummy - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test:\n#\nfunction upld(){\n#* function upld - archives old files & moves new files up\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\ntargets="Flint_vita.html Flint_vita.pdf Flint_vita.doc"\necho you are version controlling $targets\nfor n in $targets \ndo\n echo -n "step 1.) date coding file "$n" and placing it local obe directory" #D read -p " Hit enter to continue..." ans\n wget -O obe/$(date +%F)_$n http://ibm:123@family.flint.com/flint/$n \n echo -n "step 2.) uploading date coded file "$n" and placing it in zope obe directory" #D read -p " Hit enter to continue..." ans\n curl -T obe/$(date +%F)_$n http://ibm:123@family.flint.com/flint/obe/$(date +%F)_$n\n echo -n "step 3.) uploading the "$n" and placing it in flint directory" #D read -p " Hit enter to continue..." ans\n curl -T $n http://ibm:123@family.flint.com/flint/$n\ndone\n} # Test:\n#\nfunction rename(){\n#* function rename -Checks if the files are there, backs up current set and copies to "Flint_vita"[doc,html,pdf,txt]\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nprfx="Flint_vita"\nname=$(echo $var2 | cut -d "." -f 1 ) \nextn=$(echo $var2 | cut -d "." -f 2 ) \n#D echo $name" "$extn; spause\necho -n "files to back up: "; ls $prfx*\necho "Number of files is: "$(ls $prfx* |wc -l)\nif [ "$(ls $prfx* |wc -l)" -ne "4" ]; then echo "Something is wrong"; exit 1; fi\n#D \necho -n "Locally backing up the files "\nspause\nls $prfx* |while read line; do cp $line "obe/$(date +%F)_"$line ; done\n#D echo $choice; spause\n} # Test:\n#\n#\n#* function conv -Converts file into the three types we need\nfunction conv(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# uroot\ncase "$var2" in\n "0") clear; $1="help"; exit 1;;\n "htm") echo "html, good choice"; spause ;; \n "txt") echo "text, good choice"; spause ;;\n "pdf") echo "pdf, good choice" ; spause ;; \n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. To TEST:\n} # Test:\n#\n#* function c2txt - converts <file.doc> to text\nfunction c2txt(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n #D echo "This is about to happen:"\n# libreoffice --invisible -convert-to txt $var2\nabiword --to=txt $var2 --exp-props=\n#D echo "Check?"\ntxt=$(echo $var2 | rev |cut -c 4- |rev )"txt"\n#D echo $pdf; spause\n#D less "$txt"\n} # Test:\n#\n#* function c2htm - converts <file.doc> to htm\nfunction c2htm(){\n# uroot\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\necho "This is about to happen:"\n# This Did Not Work:\n# echo "libreoffice --invisible -convert-to htm $var2"\n# libreoffice --invisible -convert-to htm $var2\n# abiword --to=html $var2 --exp-props=\n# htm=$(echo $var2 | rev |cut -c 4- |rev )"html"; wvWare $var2 > $htm; firefox "file:///"$PWD"/"$htm\n# htm=$(echo $var2 | rev |cut -c 4- |rev )"html"; pandoc -s -o $var2 $htm; firefox "file:///"$PWD"/"$htm\n# htm=$(echo $var2 | rev |cut -c 4- |rev )"htm";soffice --headless --convert-to htm $var2; firefox "file:///"$PWD"/"$htm\n# htm=$(echo $var2 | rev |cut -c 4- |rev )"htm";soffice รขยยheadless รขยยconvert-to htm:HTML $var2; firefox "file:///"$PWD"/"$htm\n# htm=$(echo $var2 | rev |cut -c 4- |rev )"htm";soffice รขยยheadless รขยยconvert-to htm:HTML $var2; firefox "file:///"$PWD"/"$htm\n# htm=$(echo $var2 | rev |cut -c 4- |rev )"htm";executable รขยยheadless รขยยconvert-to htm $var2; firefox "file:///"$PWD"/"$htm\n# Finally,This Did:\n# \n# Permute names you will need.\nldoc=$(echo $var2 | rev |cut -c 4- |rev )"odt"; echo $ldoc\nhtmi=$(echo $var2 | rev |cut -c 4- |rev )"htm"; echo $htmi\nhtmo=$(echo $var2 | rev |cut -c 4- |rev )"html"; echo $htmo\n# Convert from doc to odt.\nlibreoffice --headless --convert-to odt $var2;\n# Convert from odt to html.\nlibreoffice --headless --convert-to "html:XHTML Writer File:UTF8" $ldoc;\nstrings $htmo > $htmi ; # gets rid of upper ascii if present\ncp $htmi $htmo\nrm $htmi\n#\n# TAKE OUT MISTAKES IN MS CONVERSION...\nsed -i 's/<span class="WW8Num11z0" style="display:block;float:left;min-width:0.635cm;">/<p class="P22" style="margin-left:2.0cm;">/g' $htmo\nsed -i 's/<span class="WW8Num12z0" style="display:block;float:left;min-width:0.635cm;">/<p class="P22" style="margin-left:2.0cm;">/g' $htmo\nsed -i 's/<span class="WW8Num5z0" style="display:block;float:left;min-width:0.635cm;">/ <p class="P22" style="margin-left:2.0cm;">/g' $htmo\nsed -i 's/<span class="WW8Num6z0" style="display:block;float:left;min-width:0.635cm;">/ <p class="P22" style="margin-left:2.0cm;">/g' $htmo\nsed -i 's/<span class="WW8Num8z0" style="display:block;float:left;min-width:0.635cm;">/ <p class="P22" style="margin-left:2.0cm;">/g' $htmo\n# FIX BULLET\n#D Make bullet bigger option sed -i 's/\s.</\s• </g' $htmo\n#D Eliminate the bullet option (better)\nsed -i 's/\s.</</g' $htmo\n#\n# FIX SPACING\nsed -i 's/<p class="P9">/<p class="Standard">/g' $htmo\n#D echo $htm; spause\n#D firefox "file:///"$PWD"/"$htmo\n} # Test:\n#\n#* function c2pdf - converts <file.doc> to pdf\nfunction c2pdf(){\n# uroot\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\necho "This is about to happen:"\n#D echo "libreoffice --invisible -convert-to pdf $var2"\n#D echo "OK?"\n#D spause\nlibreoffice --invisible -convert-to pdf $var2\n#D echo "Check?"\npdf=$(echo $var2 | rev |cut -c 4- |rev )"pdf"\n#D echo $pdf; spause\n#D evince "$pdf"\n} # Test:\n#\n#* function dsply - display result\nfunction dsply(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nchoice=$(echo $var2 | cut -d "." -f 2 ) \n#D echo $var2; spause\n#D echo $choice; spause\ncase $choice in\n "htm") firefox "file:///"$PWD"/"$var2 ;; \n "html") firefox "file:///"$PWD"/"$var2 ;; \n "txt") less "$var2" ;;\n "pdf") evince "$var2" 2>/dev/null;; \n *) clear; echo "Not a good choice" ; exit 1;; # Anything else run help and exit...\nesac\n} # Test:\n#\n#\nfunction tw9y(){\n#* function tw9y - converts, backs up, renames, and uploads files to family.flint.com/flint\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\necho "Begin Conversion";spause\nc2htm $var2\nc2pdf $var2\nc2txt $var2\necho -n "Backup and rename: ";spause\nrename\necho -n "Backing up remote files & uploading new file to server: "; spause\nupld\n} # Test:\n#\n#\n######################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script does not need to run as root but that's OK as you are not root" 1>&2\nfi\n} # Test:~flint/bin/mtoc.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n# echo "mtoc.sh v"$version" starts"\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n#d ARGS=$# # carries the number of args into the functions...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause \nif [ "$#" -eq "2" ] && [ "$1" = "tw9y" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "upld" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "c2htm" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "c2txt" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "c2pdf" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "conv" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "rename" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "dsply" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#d echo $#" "$1" "$2" "$3" "$ARGS ;spause \n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; $1="help"; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") flint_short_vita_2017-07-01.odtdefvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. To TEST:\n#\n# echo " "; echo "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug echo "That's all folks!!"\n#\n#d rm -rf ss # removes super secret data file\n#* restore environment cd "$S"\n}}}
'16 September 2017'\n\n* [[Dave Sez MLT is the way to go...|https://www.mltframework.org/]]\n\n\n{{{\n#!/bin/bash\n# Begun 2017-07-17 07:57:05 pflint\n# generates directory full of stills for animation\n#07-20\nversion="0.98" # Apparently bug free code... Editing needed!\nmod="0" # for future use\n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is the \s""$FUNCNAME"\s" functiOliver Wyman Labson in "$0" version "$version; uroot #debug\ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you need help and you put in the wrong number or type of ...\n## arguments. The name of this program is anibot.sh, an it is a video animation.\n## appliance. This is released under GPL I\n## The syntax is:\n## Pre Production - The goal is "anispec".\n## - anibot.sh sane - Sets check & edit directories, variables\n## help is available.\n## - anibot.sh mkrep - makes a repository, based upon sane settings\n## checks for data and date codes if duplicate\n## - anibot.sh iedl [spec file] -imports xls (makes anispec)\n## Production - The goal is "action.sh"\n## - anibot.sh check - Determines if all the pix files needed are there\n## - anibot.sh shorez - Checks resolution of images\n## - anibot.sh plate - Builds action.sh\n## Post Production The gioal is video avi files.\n## - anibot.sh encode - Runs action.sh and actually does the build\n## - anibot.sh dsply [<file.???>] displays the result of the build\n## - anibot.sh backup Backup the current data to a tar file.\n## Display View and modify completed video avi files.\n## - anibot.sh reaudio - Redo audio on finished production\n## - anibot.sh dsply [<file.avi>] View finished production\n## - anibot.sh mktv - Encode and play without running action.sh\n## - anibot.sh backup - Backup the current data to a tar file\n## in all of these, Output is delivered to the screen...\n## *** NOTE *** These commands need not be run as root!\n##\n## For structure information type "grep '^\s#\s*' anibot.sh"\n## :^)\n## (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n##\n# *****Documentation Loop ends here the rest is function******\n#\n} # Test: anibot.sh\n#\nfunction dummy(){\n#* function dummy - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test:\n#\nfunction dsply(){\n#* function dsply - Display result of process\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nsane\n#\nif [ "$var2" == "blank" ]; then\n echo "no argument supplied, so we view..."\n echo "vlc "$basedir$outdir"/final.avi"\n echo "is this OK?"\n spause\n cvlc "$basedir$outdir"/final.avi\n exit\nelse\n clear; echo "Now playing an avi file in "$basedir"outdir"\n echo "Called: "$var2\n if [ -z "$var2" ];then echo "You supplied a file name displa"; exit; fi\n echo "From the directory "$(pwd)" playing: "$var2\n spause\n cvlc $var2\n exit\nfi\n\n} # Test:\n#\n\nfunction backup(){\n#* function backup - Backup the current data to a tar file\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nsane\ncd $basedir\necho "about to launch this command:"\necho "tar -cvf ../videobu_$(date +%F) ."\nspause\ntar -cvf ../videobu_$(date +%F) .\n# To test viability of tar:\n# tar -tvf videobu_2017-09-17\n# tar -tvf ../videobu_$(date +%F) .\n} # Test:\n#\nfunction mkrep(){\n#* function mkrep - makes a repository, checks for dup and date codes if duplicate.\n# make input area\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\necho "This is the current state of your configuration: "; var2="check" sane\nfor newdir in $directory $outdir\ndo\n echo "About to make directory here: "\n echo $basedir$newdir # based upon sane\n spause\n if [[ ! -d $basedir$newdir ]];\n then\n echo "Last chance to cancel...type <ctl> c"\n echo "making "$basedir$newdir\n mkdir $basedir$newdir\n spause\n else\n echo "not making "$basedir$newdir" as it exists already..."\n echo "fix and re-run"\n exit\n fi\ndone\n# add date code here!\n} # Test:\n\n#\nfunction check(){\n#* function check - looks in "anispec" file and checks that all the files are there.\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# cat $basedir"anispec"| while read line;\nsane\n# cat anispec | cut -d "," -f 2 |rev |cut -d "/" -f 1 |rev | while read line;\ncat anispec | cut -d "," -f 2 | while read line;\ndo\n # target=$basedir$directory"/"$(echo $line)\n target=$(echo $line)\n echo -n "Looking for $target"\n # ls $target\n if [[ ! -f $target ]]; then\n echo " not found"\n else\n echo " OK"\n fi\ndone\n} # Test:\n#\n#\nfunction mstrc(){\n#* function mstrc - Master counter for animation\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\ntotal="0"\ncat anispec| while read line;\ndo\n count=$(echo $line|cut -d "," -f 1);\n # echo $count\n # for i in {1..$count}\n for (( c="1"; c<=$count; c++ ))\n do\n (( total++ ))\n cur=$(printf "%02d" $c)\n echo "$cur $(printf "%04d" $total)"\n done # inside\ndone\n} # Test:\n#\n#\nfunction plate(){\n#* function plate - creates action.sh with linked graphics for animation now with linkage...\n#D echo "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nsane\nrm -rf action.sh\ntouch action.sh\n# echo "cd $basedir$outdir" >> action.sh\necho "rm -rf "$basedir$outdir"/*" >> action.sh\n# echo "cd $basedir" >> action.sh\nchmod +x action.sh\ntotal="0"\nlstln=""\n# i=1\nspause\n# cat anispec| while read line;\n#\nfor line in $(cat anispec)\ndo\n # read -t 1\n # echo $line\n count=$(echo $line|cut -d "," -f 1)\n file=$(echo $line|cut -d "," -f 2)\n ftype=$(echo $file|cut -d "." -f 2) #; echo $ftype\n if [ "$ftype" == "png" ];\n then\n for (( c="1"; c<=$count; c++ ))\n do\n # echo $file\n (( total++ ))\n echo "ln $file $outdir"/"frame_000$(printf "%04d" $total).png" >> action.sh\n done\n else\n #D echo -e $count"\st"$file\n #\n #D echo -n $file\n i=1\n for (( c="1"; c<=$count; c++ ))\n do\n #D read -t 1 slows down the loop!!!\n # read -t 1\n # read -p "Hit enter to continue..." ans\n (( total++ ))\n cur=$(printf "%02d" $c)\n # if [ "$i" == "1" ] then;\n # if [ "$lstln" != "$line" ]; then\n if [ "$i" == "1" ];\n then\n # out="first $i"\n # out=$("convert -resize 800X600 $file -flatten $outdir"/"frame_000$(printf "%04d" $total).png; clear; echo $total")\n # baseframe=$("frame_000"$(printf "%04d" $total).png) # echo $baseframe\n baseframe="frame_000"$(printf "%04d" $total).png; echo $baseframe\n # echo "convert -resize 800X600 $file -flatten $outdir"/"frame_000$(printf "%04d" $total).png; clear; echo $total" >> action.sh\n echo "xcf2png -f $file -o $outdir"/"frame_000$(printf "%04d" $total).png; clear; echo $total" >> action.sh\n else\n # out="subsequet $i"\n # out=$("ln $outdir"/"frame_000$(printf "%04d" $total).png")\n echo "ln $outdir"/"$baseframe $outdir"/"frame_000$(printf "%04d" $total).png" >> action.sh\n fi\n ((i++))\n # echo $((i++))" "$out\n #\n # echo $out\n # read -p "Hit enter to continue..." ans\n done # inside\n fi\ndone # outside\n} # Test:\n#\nfunction nplate(){\n#* function nplate - poor attempt to make plate better. Needs work...\n#D echo "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nsane\nrm -rf action.sh\ntouch action.sh\necho "cd $basedir$outdir" >> action.sh\necho "rm -rf *" >> action.sh\necho "cd $basedir" >> action.sh\nchmod +x action.sh\ntotal="0"\nlstln=""\n# i=1\nspause\n# cat anispec| while read line;\n#\nfor line in $(cat anispec)\ndo\n # read -t 1\n # echo $line\n count=$(echo $line|cut -d "," -f 1)\n file=$(echo $line|cut -d "," -f 2)\n ftype=$(echo $file|cut -d "." -f 2) #; echo $ftype\n if [ "$ftype" == "png" ];\n then\n for (( c="1"; c<=$count; c++ ))\n do\n # echo $file\n (( total++ ))\n echo "ln $file $outdir"/"frame_000$(printf "%04d" $total).png" >> action.sh\n done\n else\n #D echo -e $count"\st"$file\n #\n #D echo -n $file\n i=1\n baseframe="frame_000"$(printf "%04d" $total).png; echo $baseframe\n #\n for (( c="1"; c<=$count; c++ ))\n do\n # read -t 1\n (( total++ ))\n cur=$(printf "%02d" $c)\n if [ "$i" == "1" ];\n then\n echo "xcf2png -f $file -o $outdir"/"frame_000$(printf "%04d" $total).png; clear; echo $total" >> action.sh\n else\n echo "ln $outdir"/"$baseframe $outdir"/"frame_000$(printf "%04d" $total).png" >> action.sh\n fi\n ((i++))\n done # inside\n fi\ndone # outside\n} # Test:\n#\nfunction shorez(){\n#* function shorez - display resolution of files in the production directory\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nsane\n# ls -1 $basedir$directory"/" ;spause\n# cd $basedir$directory"/"\ncd $basedir\nrm -rf test.txt; touch test.txt\n# echo -e "Size/t Resolution/t File Name" > test.txt\nrm -rf test.txt; echo $(date) > test.txt\nls -1 |grep xcf |while read line;\ndo\n resol=$(file $line |tr ":" ", " | sed 's/png/png,/g'| cut -d "," -f 4 |sed 's/ x /x/g')\n fname=$(file $line |tr ":" ", " | sed 's/png/png,/g'| cut -d "," -f 1)\n size=$(ls -alt $line |cut -d " " -f 5)\n echo -e $size"\st"$resol"\st"$fname >> test.txt\ndone\ncolumn -t test.txt\n\n# This might come in handy...\n# ../bin/anibot.sh shorez hello | sort -n |sed 's:x:\st:1'\n} # Test:\n#\nfunction scratch(){\n#* function scratch - scratches the working directory very specifically...\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nsane\nclear\nif [ ! -d "$outdir" ]; then\n # Control will enter here if $DIRECTORY doesn't exist.\n echo $outdir"does not exist"\n exit 0\n spause\nfi\necho "encoding to here: "$basedir$outdir;spause\necho "erasing $basedir$outdir, OK? "\nread -p "[y/N]..." erase\necho "erase is: $erase"\nif [ "$erase" == "y" ];\nthen\n echo "answer is $erase so erasing $basedir$outdir"\n cd $basedir$outdir\n rm -rf *\n cd $basedir\n pwd\nelse\n echo "answer is $erase so not erasing $basedir$outdir"\n cd $basedir$outdir\nfi\necho "The input directory is $basedir$directory"\n# ls $basedir$outdir | less\nspause\n} # Test:\n#\nfunction encode(){\n#* function encode - takes action.sh, runs it and encodes the result\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nsane\n$basedir"action.sh"\nclear; echo "Just ran action.sh"\ncd $outdir\nffmpeg -framerate 16 -f image2 -s 400x300 -i frame_%07d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p step.avi\nffmpeg -i step.avi -vf scale=400x300,setdar=4:3 silent.avi\n# this does not work processes but fails in playback.\n# ffmpeg -framerate 16 -f image2 scale=400x300,setdar=4:3 -i frame_%07d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p step.avi\n#ffmpeg -i silent.avi -i audio.wav -c copy final.avi\nffmpeg -i silent.avi -i $basedir"/"$audio -c copy final.avi\ncvlc final.avi\n} # Test:\n#\nfunction reaudio(){\n#* function reaudio - Redo audio on finished production\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nsane\ncd outdir\nffmpeg -i silent.avi -i audio.wav -c copy final.avi\ncvlc final.avi\n} # Test:\n#\nfunction mktv(){\n#* function mktv - Encode and play without running action.sh\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nsane\ncd $outdir\nffmpeg -framerate 16 -f image2 -s 400x300 -i frame_%07d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p step.avi\nffmpeg -i step.avi -vf scale=400x300,setdar=4:3 silent.avi\n# this does not work processes but fails in playback.\n# ffmpeg -framerate 16 -f image2 scale=400x300,setdar=4:3 -i frame_%07d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p step.avi\n# echo "about to do this: ln $basedir$audio $basedir$outdir"audio.wav ;spause\nln $basedir$audio $basedir$outdir"/audio.wav"\nffmpeg -i silent.avi -i audio.wav -c copy final.avi\ncvlc final.avi\n} # Test:\n#\nfunction cxvf(){\n#* function cxvf - breaks out from xcf to png images\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nsane\n# victum="test.xcf"; echo "The walk cycle Victum is: "$victum\nvictum=$1 #D; echo "The walk cycle Victum is: "$victum\n# exit\nrm *.png\n#\n# For PNG\nxcfinfo $victum |rev | cut -d " " -f 1|rev |awk NR\s>1 |while read line;\ndo\n #D echo "Converting internal xcf layer: "$line" to "$line".png";\n # xcf2png test.xcf $line > $line.png;\n xcf2png $victum $line > $line.png\n mv $line.png temp.png\n convert "temp.png" -resize "800x600!" -quality 100 "$line.png" #; file $line.png\ndone;\nrm temp.png\n# display -delay 1 *.png\n} # Test:\n#\n#\n# total frames represents how much time?\n# each frame represents 1/nth of the cycle time\n# need to sequence frames over the time of the sequence. For instance:\n# 4 frames are played over 1/2 second for 5 seconds.\n# A total number of frames for 5 seconds at 16 frames a second is 80 frames\n# Thus the total number of frames for 1/2 second of video at 16 frames a second is 8\n# Thus single frame must play twice in a 1/2 second walk sequence which gives you 8 frames\n#\nfunction wcycle(){\n#* function wcycle - outputs an animation cycle\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nsane\n#D intr="5"\n#D echo "intr is: "$intr\n# echo "checking sane"; var2="test"; sane\ntnii=$(ls -1 *.png |wc -l) #D ;echo $tnii # total number of input images\ntnof=$(echo "$intr * $fr;" | bc -l) #D ;echo $tnof # total number of output frames\nofps=$(printf "%.0f" $(echo "$intr * $fr;" | bc)) #D ; echo $ofps # number of output frames per sequence\nrps=$(printf "%.0f" $(echo "scale=0; $ofps / $tnii;" | bc)) # frame repeat per\nrepeat="0"\ncount="1"\n#D echo "# begin "$(date) >> anispec\n# for f in `seq 1 $2`; # Number of times through sequence\nfor f in `seq 1 $tnii` # Number of times through sequence\n do\n # for i in $(ls *.png); do echo $((count++)) $i; done\n for i in $(ls *.png); # images in sequence\n do\n # echo $frps,$frame >> $anispec\n for rp in `seq 1 $frps`; # frames to repeat per sequence\n do\n # fcn=$(printf "%02d"$((count++)))\n fcn=$((count++))\n # frame="$basedir/$directory/frame_000"$(printf "%04d" $fcn)".png" #D ; echo $frame\n frame="$basedir/$outdir/frame_000"$(printf "%04d" $fcn)".png" #D ; echo $frame\n #\n # echo $rp,$i >> $anispec\n echo $iscy,$i >> $anispec\n #D echo $frame # >> $anispec\n # echo $fcn # >> $anispec\n #D\n # cp $i $frame;\n # echo "convert -resize 400X300 "$i $frame\n convert -resize 400X300 $i $frame # is this needed?\n #D ls -alt $frame\n done # frame repeats\n done # frame\n done # sequence\n} # Test:\n#\n#\nfunction siedl(){\n#* function siedl - import edit decision list makes anispec loop test\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# NOTE: This version must use the new format spreadsheet!!!\n# 2017-09-05 17:38:20\n# Complicated, Many variables. Here is the cast of characters...\n# mnts - Whole minutes in sequence.\n# frno - Frame number in two digits\n# finm - File name\n# stst - Seconds To STop the value of the seconde in the stop time\n# start - Begins at 0.00 and is the stop time of the previous section\n# stop - When segment ends - becomes start for next section\n# intr - Interval ($stop - $start) in seconds\n# isec - Interval in seconds\n# nofr - Number of frames in sequence\n# wcst - Walk cycle sequence time in seconds\n# The idea is that the codes cycles the last segment's end time to the next\n# segments start time.\nsane\n# echo "Your base path and directory are: "$basedir$directory\necho "converting $var2"\nrm -rf $basedir"test.csv"; touch $basedir"test.csv"\nhead=$(grep "Seg" edl.csv)\necho $head",\s"nofr\s",\s"intr\s"" >> $basedir"test.csv"\n# $nofr","$intr\n# ls -alt $anispec; spause\nif [ "$var2" != "blank" ]; then\n ssconvert $var2 edl.csv # 2>/dev/null\nfi\nspause\nstart="00.000"\ni="1"\ncat edl.csv |grep -v "Seg" |while read line;\ndo\n frno=$(printf "%02d" $(echo $line | cut -d "," -f 1))\n finm=$(echo $line | cut -d "," -f 5 |rev |cut -d "/" -f 1 |rev )\n # This next line represents the number of minutes in the third column.\n # echo $mnts\n tvbl=$(echo $line | cut -d "," -f 3 |grep -v [a-zA-Z] |cut -d ":" -f 1 )\n if [ "$tvbl" -eq "$tvbl" ] 2>/dev/null; then\n echo number\n else\n echo not a number\n # non=$(echo $tvbl |grep [0-9] )\n # non=$(echo $tvbl |tr -d '"' ); echo "non is: "$non\n # tvbl=$non ;echo "tvbl now is: "$tvbl\n tvbl="00"\n fi\n echo "tvbl is: "$tvbl\n mnts=$(($tvbl * 60 )) #;\n echo $mnts\n # stst=$(echo $line | cut -d "," -f 3 |cut -d ":" -f 2- |tr ":" "." |tr -d '\sr')\n stst=$(echo $line | cut -d "," -f 3 |tr -d [:space:]|tr -d '"'|cut -d ":" -f 2- |tr ":" "." |tr -d '\sr')\n echo $stst\n echo $(echo $line | cut -d "," -f 3 |tr -d [:space:])\n stop=$(echo "$mnts" + "$stst" | bc )\n intr=$(echo "$stop - $start" | bc)\n start=$(echo $stop | tr -d '\sr')\n isec=$(echo "($intr+0.5)/1" | bc)\n nofr=$(echo "($(echo "$intr * $fr" | bc)+0.5)/1" | bc)\n iscy=$(echo $line| cut -d "," -f 6) #; echo $iscy # Length of cycle\n # echo -e $frno"\st"$isec"\st"$nofr"\st"$start"\st"$stop"\st"$intr"\st"$finm\n # echo $nofr","$basedir$directory"/"$finm | grep -v "^-" >> $anispec\n if [ "$iscy" == "Still" ]; then\n # echo "still"\n # echo $nofr","$finm | grep -v "^-" # >> $anispec\n # echo $nofr","$finm >> $anispec\n echo $line","$nofr","$intr >> $basedir"test.csv"\n # echo $line","$nofr","$intr/n | tee $basedir"test.csv"\n # printf $line","$nofr","$intr\sn | tee $basedir"test.csv"\n else\n wcst==$(echo $line | cut -d "," -f 3);echo $wcst\n # echo "cxvf "$finm\n cxvf $finm\n wcycle $finm\n # mnts="0"; echo $mnts\n fi\n #D echo -ne $((i++))"\st"\n #D echo $nofr","$basedir$directory"/"$finm | grep -v "^-"\ndone\n# echo "mnts is: :"$mnts\n# less anispec\n#D echo "That's all Folks!"\n} # Test:\n\nfunction iedl(){\n#* function iedl - import edit decision list makes anispec\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# NOTE: This version must use the new format spreadsheet!!!\n# 2017-09-05 17:38:20\n# Complicated, Many variables. Here is the cast of characters...\n# mnts - Whole minutes in sequence.\n# frno - Frame number in two digits\n# finm - File name\n# stst - Seconds To STop the value of the seconde in the stop time\n# start - Begins at 0.00 and is the stop time of the previous section\n# stop - When segment ends - becomes start for next section\n# intr - Interval ($stop - $start) in seconds\n# isec - Interval in seconds\n# nofr - Number of frames in sequence\n# The idea is that the codes cycles the last segment's end time to the next\n# segments start time.\nsane\n# echo "Your base path and directory are: "$basedir$directory\necho "converting $var2"\nrm -rf $anispec; touch $anispec\n# ls -alt $anispec; spause\nif [ "$var2" != "blank" ]; then\n ssconvert $var2 edl.csv 2>/dev/null\nfi\nspause\nstart="00.000"\ni="1"\ncat edl.csv |grep -v "Seg" |while read line;\ndo\n frno=$(printf "%02d" $(echo $line | cut -d "," -f 1))\n finm=$(echo $line | cut -d "," -f 5 |rev |cut -d "/" -f 1 |rev )\n # This next line represents the number of minutes in the third column.\n mnts=$(( $(echo $line | cut -d "," -f 3 |grep -v [a-zA-Z] |cut -d ":" -f 1 ) * 60 )) #;echo $mnts\n # stst=$(echo $line | cut -d "," -f 3 |grep -v [a-zA-Z] |cut -d ":" -f 2- |tr ":" "." |tr -d '\sr')\n stst=$(echo $line | cut -d "," -f 3 |tr -d [:space:]|tr -d '"'|cut -d ":" -f 2- |tr ":" "." |tr -d '\sr')\n stop=$(echo "$mnts" + "$stst" | bc )\n intr=$(echo "$stop - $start" | bc)\n start=$(echo $stop | tr -d '\sr')\n isec=$(echo "($intr+0.5)/1" | bc)\n nofr=$(echo "($(echo "$intr * $fr" | bc)+0.5)/1" | bc)\n iscy=$(echo $line| cut -d "," -f 6) #; echo $iscy\n # echo -e $frno"\st"$isec"\st"$nofr"\st"$start"\st"$stop"\st"$intr"\st"$finm\n # echo $nofr","$basedir$directory"/"$finm | grep -v "^-" >> $anispec\n if [ "$iscy" == "Still" ]; then\n # echo "still"\n # echo $nofr","$finm | grep -v "^-" # >> $anispec\n echo $nofr","$finm >> $anispec\n else\n # echo "cxvf "$finm\n cxvf $finm\n wcycle $finm\n fi\n #D echo -ne $((i++))"\st"\n #D echo $nofr","$basedir$directory"/"$finm | grep -v "^-"\ndone\n# echo "mnts is: :"$mnts\n# less anispec\n#D echo "That's all Folks!"\n} # Test:\n#\n#*###################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script does not need to run as root but that's OK as you are not root" 1>&2\nfi\n} # Test:~flint/bin/mtoc.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\nfunction sane(){\n#* function sane - Make the program sane. Sets lists & edit directories, variables\n# echo "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# this update somehow needs to be documented each run.\n#D echo "This is var2: "\nbasedir="/home/flint/ally/2017/Videos2Chili/"\ndirectory="pf_2017-09-16"\nanispec="anispec"\noutdir="outdir"\naudio="Lets_All_go_to_the_Lobby!_Intermission_Bumper.wav"\nfr=16\n#\nliston="basedir directory anispec outdir audio fr" #list of targets to search for\ncase "$var2" in\n "" ) ;; # got nothing, set variables silently\n\n "show" ) # Show version stuff and exit\n echo "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n ;;\n"check" ) # clear # describe current variables in play\n echo -e "The base directory is: \st\st"$basedir\n echo -e "The working directory is: \st"$directory\n echo -e "The animation specification is: \st"$anispec\n echo -e "The results are in directory: \st"$outdir\n echo -e "The audio file is: \st"$audio\n echo -e "The frame rate is: \st"$fr\n ;;\n "test" ) # clear # list out current variables in play\n i="1"\n echo "This is sane test"\n for name in $liston\n do\n echo -ne "$((i++)). \st"; grep "^$name=" $0\n done\n ;;\n "edit" ) # clear # Interactively edit list\n i="1"\n echo "This is sane edit"\n for name in $liston\n do\n echo -ne "$((i++)). \st"; grep "^$name=" $0\n done\n read -p "what number would you like to edit? " ans\n # echo $ans\n i="1"\n echo "Do not forget to type quotes in your replacement string"\n for name in $liston\n do\n # echo -ne "$((i++)). \st"; grep "^$name=" $0\n # if [ "$i" == "$ans" ]; then echo -e $i"\st "$name"="; fi\n if [ "$i" == "$ans" ];\n then\n # echo -n " ";grep "^$name=" $0\n #D\n target=$(grep "^$name=" $0)\n echo -n " ";echo $chnglng\n read -p" "$name"=" change;\n chnglng=$name"="$change;\n fi\n # echo $((i++)) > /dev/null\n ((i++))\n done\n #\n # echo "target is: "$target\n # echo "change is: "$chnglng\n # echo "sed -i 's:$target:$chnglng:g' $0"\n rm doit.sh 2>/dev/null; touch doit.sh; chmod +x doit.sh\n rm undo.sh 2>/dev/null; touch undo.sh; chmod +x undo.sh\n echo 'echo "Just changed the file"' >> doit.sh\n echo 'echo "Just changed the file back"' >> undo.sh\n echo "sed -i 's:$target:$chnglng:g' $0" >> doit.sh\n echo "sed -i 's:$chnglng:$target:g' $0" >> undo.sh\n # ./doit.sh\n #D\n ./doit.sh; rm -rf doit.sh\n ;;\n "save" ) # list out current variables in play\n clear\n i="1"\n echo "This is sane save"\n fname=$var3\n if [ -z "$var3" ];then echo "You must supply a name to save file in"; exit; fi\n rm -rf $fname 2>/dev/null; touch $fname\n for name in $liston\n do\n # echo -ne "$((i++)). \st"; grep "^$name=" $0 > test.ini\n outln="$((i++)). "$(grep "^$name=" $0)\n echo $outln >> $fname\n done\n ;;\n "load" ) clear # Saves variables to filename\n echo "This is the \s"load\s" case in \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n fname=$var3\n if [ -z "$var3" ];then echo "You must supply a file name to load"; exit; fi\n i="1"\n rm doit.sh 2>/dev/null; touch doit.sh; chmod +x doit.sh\n rm undo.sh 2>/dev/null; touch undo.sh; chmod +x undo.sh\n echo 'echo "Just changed the file"' >> doit.sh\n echo 'echo "Just changed the file back"' >> undo.sh\n cat $fname |while read line\n do\n prefix=$(echo $line |cut -d " " -f2 |cut -d "=" -f 1 ) #; echo -n $prefix"="\n change=$(echo $line |rev |cut -d "=" -f 1|rev) #; echo $change\n chnglng=$prefix"="$change #; echo -n $chnglng\n target=$(grep "^$prefix=" $0) #;echo -e "\st "$chnglng\n echo "sed -i 's:$target:$chnglng:g' $0" >> doit.sh\n echo "sed -i 's:$chnglng:$target:g' $0" >> undo.sh\n done\n ./doit.sh; #D rm -rf doit.sh 2>/dev/null\n ;;\n"xload" ) clear # list out current variables in play\n echo "This is the \s"load\s" case in \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n echo "The idea is to load the changes from an xls file"\n echo "Maybe this will be working in the next version sorry for now..."\n ;;\n"xsave" ) clear # list out current variables in play\n echo "This is the \s"load\s" case in \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n echo "The idea is to savve the changes to an xls file"\n echo "Maybe this will be working in the next version sorry for now..."\n ;;\n\n"help" ) clear # Display help\n echo "This is the supplemental help for the sane routine"\n echo " (nothing) - Set variables silently"\n echo " show - Show version stuff"\n echo " test - List out current variables in play"\n echo " edit - Interactively edit list"\n echo " check - Check what all is going on"\n echo " load|save <filename>"\n echo " - load or save from supplied filename"\n echo " xload|xsave <filename.xls>"\n echo " - load from supplied spreadsheet"\n echo " help - Display this message"\n # Show the list:\n # cat ../bin/anibot.sh |grep \s"*\s"" "\s)\n ;;\nesac # anibot sane help\n} # Test:\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n# echo "mtoc.sh v"$version" starts"\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n#d ARGS=$# # carries the number of args into the functions...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause\nif [ "$#" -eq "1" ] && [ "$1" = "mkrep" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "iedl" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "siedl" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "dsply" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "reaudio" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "reaudio" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "check" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dsply" ]; then ARGS="7"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "dsply" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "shorez" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "encode" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "backup" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "mstrc" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "plate" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "cplate" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "mktv" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "ltest" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "ctest" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "wcycle" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "sane" ]; then ARGS="8"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "sane" ]; then ARGS="2"; fi\nif [ "$#" -eq "3" ] && [ "$1" = "sane" ]; then ARGS="3"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "cxvf" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "cxvf" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause\n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; $1="help"; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") var2="blank"; $1 ;; # run the command and default variables\n "8") var2=""; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. To TEST:\n#\n# echo " "; echo "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug echo "That's all folks!!"\n#\n#d rm -rf ss # removes super secret data file\n#* restore environment cd "$S"\n\n}}}\n\n
'20 July 2017'\n\n\n*[[Convert PNG to movie |http://hamelot.io/visualization/using-ffmpeg-to-convert-a-set-of-images-into-a-video/]]\n* [[ffmpeg manual|https://ffmpeg.org/ffmpeg.html]]\n* [[Cats who code|https://www.catswhocode.com/blog/19-ffmpeg-commands-for-all-needs]]\n* [[Wiki Books on ffmpeg|https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/image_sequence]]\n\nThis actually works:\n{{{\nffmpeg -framerate 16 -f image2 -s 400x300 -i frame_%07d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p test.avi\n}}}\n\n* [[Resizing with ffmpeg|https://trac.ffmpeg.org/wiki/Scaling%20(resizing)%20with%20ffmpeg]]
Type the text for '29 September 2017'\n\n[[ctob.sh|http://docbox.flint.com:8081/3Dprint/#ctob.sh]] is a diagnostic for the Openbuild system
Type the text for '1 October 2017'\n\n{{{\n#!/bin/bash\n# pflint Fri 17 May 2013 07:49:14 AM EDT \n# packs html into String and makes changes at the end...\n# \n# this is the origin point:\norigin="http://www.w3.org/TR/html4/strict.dtd"\n#\n# the following evaluates the string... go to line 79 for more stuff...\n# change this line <meta http-equiv="refresh" content="10;url=http://10.0.1.45/furmon/out.html">\nread -d '' String <<"EOF"\n<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n<html><head>\n<meta http-equiv="refresh" content="10">\n<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>Pellergy Control For Furmon Site</title>\n\n</head>\n<body>\n<img style="width: 847px; height: 642px;" alt="Drawing of control plate should be here" src="http://docbox.flint.com/%7Eflint/furmon/Pellergy_Control_blank_plate.png">\n<table style="position: relative; z-index: 1; left: 120px; top: -500px; width: 606px; height: 215px;" cellpadding="2" cellspacing="2">\n<tbody>\n<tr>\n<td colspan="2" rowspan="1" style="position: relative; width: 305px;"><big>\nopstate </big><br>\n</td>\n<td colspan="3" rowspan="1" style="position: relative; width: 257px;"><big>\nstate_counter </big><br>\n</td>\n</tr>\n<tr>\n<td colspan="2" rowspan="1" style="position: relative; width: 103px;">No Alarm<br>\n</td>\n<td colspan="3" rowspan="1" style="position: relative; width: 257px;">All is well<br>\n</td>\n</tr>\n<tr>\n<td style="position: relative; width: 100px;">Call <br>\n</td>\n<td style="position: relative; width: 100px;">Resets\n<br>\n</td>\n<td style="position: relative; width: 140px;">stack_temp\n℉ <br>\n</td>\n<td style="position: relative; width: 160px;">system_temp\n℉ <br>\n</td>\n<td style="position: relative; width: 130px;">Blower<br>\n</td>\n</tr>\n<tr>\n<td style="position: relative; width: 120px;">\n<br>\n</td>\n<td style="position: relative; width: 130px;">Button1\n<br>\n</td>\n<td style="position: relative; width: 140px;">Button2\n<br>\n</td>\n<td style="position: relative; width: 140px;">Button3<br>\n</td>\n<td style="position: relative; width: 140px;">Button4<br>\n</td>\n</tr>\n<tr>\n<td style="position: absolute; top: 542px; left: 190px;">Param<br>\n</td>\n<td style="position: absolute; top: 542px; left: 343px;">Test<br>\n</td>\n<td style="position: absolute; top: 542px; left: 491px;">Enabl<br>\n</td>\n<td style="position: absolute; top: 541px; left: 643px;">Feed</td>\n</tr>\n</tbody>\n</table>\n<br>\n<br>\n</body></html>\nEOF\n# echo "this is the string"\necho "$String" > in.html\nrm -rf outpcp.html\nnewrd1=$1\nnewrd2=$2\nt11="test 1,1"\nt12="test 1,2"\n#\n# This takes the couplets and makes the changes...\necho "0 is $0"\necho "Number of Arguments are $#"\necho $@\necho "This starts the changes arguments must be in pairs, target:change"\necho $@\nfor f in $@; \ndo \n target=${f%:*}; \n change=${f#*:}; \n echo "Next change $target $change"; \n changed=${String/$target/$change}; String=$changed \ndone\necho "$String" > out.html\necho "the difference between these strings is"\n#diff -y in.html out.html | less -S\ndiff in.html out.html #| less -NS\n# sleep 5\n# echo "Type cntrl -c to stop firefox now"\n# firefox 2>/dev/null out.html\ncp /home/flint/furmon/out.html /home/flint/sshfs\n}}}
Type the text for '1 October 2017'\n|!Reference HTML|! Description|\n|[[Expect spawn and interact |https://www.google.com/search?q=stty+spawn+interact&ie=utf-8&oe=utf-8&client=ubuntu&channel=fs]]||\n|[[Expect spawn and interact stack overflow |https://stackoverflow.com/questions/30113177/tcl-expect-after-interact-expect-user-doesnt-echo]]||\n|[[Expect man page |https://www.tcl.tk/man/expect5.31/expect.1.html]]||\n|[[Google Expect Search |https://www.google.com/search?q=%22expect%22+serial+interaction&ie=utf-8&oe=utf-8&client=ubuntu&channel=fs]]||\n|[[Sourceforge Expect |http://expect.sourceforge.net/]]||\n|[[Sourceforge Expect Unix |http://expect.sourceforge.net/#unix]]||\n|[[Sourceforge Expect Examples |http://expect.sourceforge.net/#examples]]||\n|[[Tcl.tk |http://wiki.tcl.tk/11583]]||\n|[[Stack Overflow expect-tcl-and-serial-port-interaction |https://stackoverflow.com/questions/21560846/expect-tcl-and-serial-port-interaction]]||\n|[[Stack Overflow how-to-suppress-expect-send-output|https://stackoverflow.com/questions/26803188/how-to-suppress-expect-send-output]]||
Type the text for '6 November 2017'\n\n[[Shell Check|https://www.shellcheck.net/]]
Type the text for '5 December 2017'\n\n> No you don't because those are commands, not files (which was not clear at\n> all)\n>\n> A more realistic example...\n>\n> seq 3 | tee >(cat -e) >(cat -n) > /dev/null # `cat -e` prints dollar signs\n>> at the end of line and `cat -n` numbers the lines\n> \n>\n> prints out both 1 through 3 with dollar signs at the end of the line and 1\n> through 3 numbered\n>\n\n\n\n
Type the text for '11 December 2017'\n\n* [[GUI Calls shell scripts|https://help.ubuntu.com/community/NautilusScriptsHowto]]
Type the text for '30 December 2017\n\n[[Ubiquitous Bash|https://cdn.rawgit.com/mirage335/ubiquitous_bash/master/USAGE.html]]
Type the text for '19 February 2018'\n\n[[Cross Reference|http://docbox.flint.com:8081/blockchain/#BlockChainGames%20BlockChainSources]]
Type the text for '20 February 2018'\n\nMove Down Freaking Tiddler\n\n{{{\n#!/bin/bash\n#\nversion="0.002"\n# 02/19/2018 04:05:41 PM pflint\n# moves down and sets up program to run...\n# wget http://docbox.flint.com:8081/blockchain/#bcttt.sh\n# wget http://docbox.flint.com:8081/blockchain/index.html\nwget http://docbox.flint.com:8081/blockchain/#bcttt.sh\nless index.html\n# note: you get the w#!/bin/bash\n#\nversion="0.001"\n# 02/19/2018 04:05:41 PM pflint\n# moves down and sets up program to run...\n# wget http://docbox.flint.com:8081/blockchain/#bcttt.sh\n# wget http://docbox.flint.com:8081/blockchain/index.html\nwget http://docbox.flint.com:8081/blockchain/#bcttt.sh\nless index.html\n# note: you get the whole tiddler...\n#\n# strip out the tiddler you want\n# grep bcttt.sh index.html > 1step.html\ncat index.html | grep "div tiddler=" |grep "bcttt.sh" | head -1 > 1step.html\n# less 1step.html\n#\n# reset line feeds\ncat 1step.html |sed 's/\s\sn/\sn/g' > 2step.html\n#\n# fixe typography\nsed -i 's/"/\s"/g' 2step.html\nsed -i 's/>/\s>/g' 2step.html\nsed -i 's/</\s</g' 2step.html\nsed -i 's/&/\s&/g' 2step.html\n#\n# extract data from between curly brackets\n# cat 2step.html |sed 's/{{{/HEADER/g' | sed 's/}}}/FOOTER/g'\n# cat 2step.html |awk '/HEADER/ { show=1 } show; /FOOTER/ { show=0 }' |less\ncat 2step.html |sed 's/{{{/HEADER/g' | sed 's/}}}/FOOTER/g'| awk '/HEADER/ { show=1 } show; /FOOTER/ { show=0 }' > bcttt.sh\nsed -i 's/HEADER/ /g' bcttt.sh\nsed -i 's/FOOTER/ /g' bcttt.sh\n# sed -i 's/\s/ss/\s//g' bcttt.sh\n#\n# sed -i 's/\s\s/\s//g' bcttt.sh\n#\nchmod +x bcttt.sh\n# less bcttt.sh\n#\n# Clean up...\n# rm -rf 1step.html\n# rm -rf 2step.htmt\n#\n# fix strange thing...\n# sed -i 's/\s/s/\s\s/g' bcttt.sh\n# sed -i 's/\s\ss/\s//g' bcttt.sh\nsed -i 's/\s\ss/\s\s/g' bcttt.sh\n#\nclear\necho "All done. Run the following:"\necho "./bcttt.sh"\necho "Enjoy!"hole tiddler...\n#\n# strip out the tiddler you want\n# grep bcttt.sh index.html > 1step.html\ncat index.html | grep "div tiddler=" |grep "bcttt.sh" | head -1 > 1step.html\n# less 1step.html\n#\n# reset line feeds\ncat 1step.html |sed 's/\s\sn/\sn/g' > 2step.html\n#\n# fixe typography\nsed -i 's/"/\s"/g' 2step.html\nsed -i 's/>/\s>/g' 2step.html\nsed -i 's/</\s</g' 2step.html\nsed -i 's/&/\s&/g' 2step.html\n#\n# extract data from between curly brackets\n# cat 2step.html |sed 's/{{{/HEADER/g' | sed 's/}}}/FOOTER/g'\n# cat 2step.html |awk '/HEADER/ { show=1 } show; /FOOTER/ { show=0 }' |less\ncat 2step.html |sed 's/{{{/HEADER/g' | sed 's/}}}/FOOTER/g'| awk '/HEADER/ { show=1 } show; /FOOTER/ { show=0 }' > bcttt.sh\nsed -i 's/HEADER/ /g' bcttt.sh\nsed -i 's/FOOTER/ /g' bcttt.sh\n# sed -i 's/\s/ss/\s//g' bcttt.sh\n#\n# sed -i 's/\s\s/\s//g' bcttt.sh\n#\nchmod +x bcttt.sh\n# less bcttt.sh\n#\n# Clean up...\n# rm -rf 1step.html\n# rm -rf 2step.htmt\n#\n# fix strange thing...\n# sed -i 's/\s/s/\s\s/g' bcttt.sh\n# sed -i 's/\s\ss/\s//g' bcttt.sh\nsed -i 's/\s\ss/\s\s/g' bcttt.sh\n#\nclear\necho "All done. Run the following:"\necho "./bcttt.sh"\necho "Enjoy!"\n}}}
Type the text for '26 February 2018'\n\nversion of sane that contains potrite\n\n{{{\n#\nfunction sane(){\n#* function sane - Make the program sane. Sets lists & edit directories, variables\n# echo "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# this update somehow needs to be documented each run.\n#D echo "This is var2: "\ntiddleurl="http://docbox.flint.com:8081/blockchain/"\nuser="the"\npass="END"\noutdir="outdir"\n# audio="Lets_All_go_to_the_Lobby!_Intermission_Bumper.wav"\n# fr=16\n# echo -e " TiddleURL is\st"$tiddleurl\n# echo -e " User is \st"$26 February 2018user\n# echo -e " PASS is \st"$pass\n#\nliston="user pass outdir=" #list of targets to search for\ncase "$var2" in\n "" ) ;; # got nothing, set variables silently\n\n "show" ) # Show version stuff and exit\n echo "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n ;;\n"check" ) # clear # describe current variables in play\n # echo -e "The base directory is: \st\st"$basedir\n # echo -e "The working directory is: \st"$directory\n # echo -e "The animation specification is: \st"$anispec\n # echo -e "The results are in directory: \st"$outdir\n # echo -e "The audio file is: \st"$audio\n # echo -e "The frame rate is: \st"$fr\n echo -e " TiddleURL is\st\st"$tiddleurl\n echo -e " User is \st\st"$user\n echo -e " PASS is \st\st"$pass\n echo -e " The local directory: \st"$outdir\n ;;\n "test" ) # clear # list out current variables in play\n i="1"\n echo "This is sane test"\n for name in $listo26 February 2018n\n do\n echo -ne "$((i++)). \st"; grep "^$name=" $0\n done\n ;;\n "edit" ) # clear # Interactively edit list\n i="1"\n echo "This is sane edit"\n for name in $liston\n do\n echo -ne "$((i++)). \st"; grep "^$name=" $0\n done\n read -p "what number would you like to edit? " ans\n # echo $ans\n i="1"\n echo "Do not forget to type quotes in your replacement string"\n for name in $liston\n do\n # echo -ne "$((i++)). \st"; grep "^$name=" $0\n # if [ "$i" == "$ans" ]; then echo -e $i"\st "$name"="; fi\n if [ "$i" == "$ans" ];\n then\n # echo -n " ";grep "^$name=" $0\n #D\n target=$(grep "^$name=" $0)\n echo -n " ";echo $chnglng\n read -p" "$name"=" change;\n chnglng=$name"="$change;\n fi\n # echo $((i++)) > /dev/null\n ((i++))\n done\n #\n # echo "target is: "$target\n # echo "change is: "$chnglng\n # echo "sed -i 's:$target:$chnglng:g' $0"\n rm doit.sh 2>/dev/null; touch doit.sh; chmod +x doit.sh\n rm undo.sh 2>/dev/null; touch undo.sh; chmod +x undo.sh\n echo 'echo "Just changed the file"' >> doit.sh\n echo 'echo "Just changed the file back"' >> undo.sh\n echo "sed -i 's:$target:$chnglng:g' $0" >> doit.sh\n echo "sed -i 's:$chnglng:$target:g' $0" >> undo.sh\n # ./doit.sh\n #D\n ./doit.sh; rm -rf doit.sh\n ;;\n "save" ) # list out current variables in play\n clear\n i="1"\n echo "This is sane save"\n fname=$var3\n if [ -z "$var3" ];then echo "You must supply a name to save file in"; exit; fi\n rm -rf $fname 2>/dev/null; touch $fname\n for name in $liston\n do\n # echo -ne "$((i++)). \st"; grep "^$name=" $0 > test.ini\n outln="$((i++)). "$(grep "^$name=" $0)\n echo $outln >> $fname\n done\n ;;\n "load" ) clear # Saves variables to filename\n echo "This is the \s"load\s" case in \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n fname=$var3\n if [ -z "$var3" ];then echo "You must supply a file name to load"; exit; fi\n i="1"\n rm doit.sh 2>/dev/null; touch doit.sh; chmod +x doit.sh\n rm undo.sh 2>/dev/null; touch undo.sh; chmod +x undo.sh\n echo 'echo "Just changed the file"' >> doit.sh\n echo 'echo "Just changed the file back"' >> undo.sh\n cat $fname |while read line\n do\n prefix=$(echo $line |cut -d " " -f2 |cut -d "=" -f 1 ) #; echo -n $prefix"="\n change=$(echo $line |rev |cut -d "=" -f 1|rev) #; echo $change\n chnglng=$prefix"="$change #; echo -n $chnglng\n target=$(grep "^$prefix=" $0) #;echo -e "\st "$chnglng\n echo "sed -i 's:$target:$chnglng:g' $0" >> doit.sh\n echo "sed -i 's:$chnglng:$target:g' $0" >> undo.sh\n done\n ./doit.sh; #D rm -rf doit.sh 2>/dev/null\n ;;26 February 2018\n"xload" ) clear # list out current variables in play\n echo "This is the \s"load\s" case in \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n echo "The idea is to load the changes from an xls file"\n echo "Maybe this will be working in the next version sorry for now..."\n ;;\n"xsave" ) clear # list out current variables in play\n echo "This is the \s"load\s" case in \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n echo "The idea is to savve the changes to an xls file"\n echo "Maybe this will be working in the next version sorry for now..."\n ;;\n\n "ptrt" ) clear # Display help\n echo "This is the potrite function"\n #* check location of vital files and programs, sanity check\n echo "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n rm -rf need > /dev/null\n requirements="sphinx-common sphinx-doc python-sphinx git pv apache2 #D banana"\n # for prog in sphinx-common sphinx-doc python-sphinx git pv apache2 #D banana # programs you need put here\n for prog in $requirements # programs you need put here\n do\n # echo $prog\n # Better SOURCE:https://www.cyberciti.biz/faq/find-out-if-package-is-installed-in-linux/\n answer=$(echo $(dpkg-query -W -f='${Status} ${Version}\sn' $prog)| cut -d " " -f 3)\n # echo $answer\n if [ "$answer" != "installed" ];\n then\n echo $prog >> need\n #debug echo "Type \s"sudo apt-get install $prog\s" to fix this."\n #debug spause\n # exit 0\n fi\n done\n #D clear\n echo "Welcome to $0!"\n # uroot\n echo "Missing programs:"\n if [ -f need ];\n then\n echo " This program needs the following program(s) to be installed on this system."\n cat need |while read line; do echo -e \s\st" - " $line; done\n if [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2\n echo "You want them installed if you are root they will install"\n echo "Leaving this function without installing anything"\n exit\n fi\n spause\n cat need |while read line; do\n echo "apt-get --yes install $line"\n apt-get --yes install $line\n done\n #D\n rm -rf need\n exit 0 # breaks you out of loop...\n else\n echo " * None * Looks like the pot's right, lets play!"\n fi\n #\n echo "end of check"\n ;;\n\n"help" ) clear # Display help\n echo "This is the supplemental help for the sane routine"\n echo " (nothing) - Set variables silently"\n echo " show - Show version stuff"\n echo " test - 26 February 2018List out current variables in play"\n echo " edit - Interactively edit list"\n echo " check - Check what all is going on"\n echo " load|save <filename>"\n echo " - load or save from supplied filename"\n echo " xload|xsave <filename.xls>"\n echo " - load from supplied spreadsheet"\n echo " ptrt - Check for dependencies"\n echo " help - Display this message"\n # Show the list:\n # cat ../bin/anibot.sh |grep \s"*\s"" "\s)\n ;;\nesac # anibot sane help\n} # Test:\n#\nclear\necho "welcome to" $0\nvar2=$2\nsane\necho $2\necho $var2\necho $tiddleurl #="http://docbox.flint.com:8081/blockchain/"\necho $user #="the"\necho $pass #="END"\necho $outdir #="outdir"\n\n}}}
Type the text for '23 March 2018'\n\n{{{\n#!/bin/bash\n#\n# make music of last resort...\n# \nmuroot="/dev/sdb3"\n# Check forn root directory being mounted \nchkrt=$(df -h | grep sdb3 |tr -s [:space:] |cut -d " " -f 1)\necho "muroot="$muroot\necho "chkrt="$chkrt\nif [ "$muroot" == "$chkrt" ]; then\n echo "pot's right lets play"\nfi\n# force unmount?\n# umount -l $muroot\n#\nsroot=$(df -h | grep $muroot |rev |tr -s [:space:] |cut -d " " -f 1 |rev); echo $sroot\ncd $sroot\nfind . | grep mp3^\n\n#* Make the file\n#* Select A Random Line from the file\n#* Play the Random Selection.\n#D man shuf\n#* Play the random Selection.\n#* Select another Random line from file\n#* Lather, rinse, repeat\n}}}
Type the text for '30 March 2018'\n\nThis could be very useful...\n\n* [[wmctrl homepage|http://tripie.sweb.cz/utils/wmctrl/]]\n* [[wmctrl good docs|https://blog.spiralofhope.com/1042/wmctrl-user-documentation.html]]\n* [[Wikipedia on wmctrl|https://en.wikipedia.org/wiki/Wmctrl]]\n* [[Linux Journal Article|http://www.linuxjournal.com/magazine/hack-and-automate-your-desktop-wmctrl]]\n** {{{wmctrl -l | less -NS}}}\n** [[Turn off line wrap|http://docbox.flint.com:8081/geekland#SetNoWrap]]\n
Type the text for '31 May 2018'\n\nIs [[parallel|https://www.techrepublic.com/article/how-to-run-commands-simultaneously-with-gnu-parallel/]] interesting?\n\nOnly testing will tell...
Type the text for '1 August 2018'\n\nUse [[adb remote control|http://docbox.flint.com:8081/geekland#ADBRemoteControlDialer]] to dial phones...\n\n* [[DTG Suggests|https://stackoverflow.com/questions/25897758/query-a-phone-call-via-adb-commands]]\n* [[Votebuilder|http://www.vtdemocrats.org/sites/vtdems/files/pictures/VANual%20v15.1.pdf]]\n* [[Android making phone calls|https://google-developer-training.gitbooks.io/android-developer-phone-sms-course/content/Lesson%201/1_c_phone_calls.html]]\n* [[App Permissions|https://support.google.com/googleplay/answer/6270602?hl=en]]\n\nWhat is [[aapt]]\n\nDump packages\n{{{\nadb shell dumpsys package\n}}}
Type the text for 'New Tiddler'\n\nhttp://docbox.flint.com:8081/email#MailManagerScript]]
Type the text for '16 July 2018'\n\nStuff ffind should do:\n\n# find date in current year:\n{{{\nfind . | grep pdf | xargs ls -alt 2>/dev/null| grep "Sep [0-9][0-9] [0-9]" 2>/dev/null\n}}}\n\n{{{\nmonth="Sep";find . | grep pdf | xargs ls -alt 2>/dev/null| grep $month" [0-9][0-9] [0-9]" 2>/dev/null\n}}}\n\n{{{\nfor month in Sep Oct Nov; do echo "checking "$month; find . | grep pdf | xargs ls -alt 2>/dev/null| grep $month" [0-9][0-9] [0-9]" 2>/dev/null;done\n}}}\n\n\n{{{\nfor month="Sep Oct Nov";do;find . | grep pdf | xargs ls -alt 2>/dev/null| grep $month" [0-9][0-9] [0-9]" 2>/dev/null;done\n}}}\n\nff1.sh\n{{{\n#/bin/bash\n# pflint 5 November 2018 \nfind . | grep pdf | xargs ls -alt 2>/dev/null| grep $1" [0-9][0-9] [0-9]" 2>/dev/null\n}}}\n\nff2.sh\n{{{\n#/bin/bash\n# pflint 5 November 2018\nfoo="${1^}"\nfind . | grep pdf | xargs ls -alt 2>/dev/null| grep $foo" [0-9][0-9] [0-9]" 2>/dev/null\n# echo "${foo^}"\necho "Done"\n}}}\n\n
Type the text for '17 December 2018'\n\n{{{\n#!/bin/bash\n# pflint 2017-01-09 11:28:49 \n# manages resume update\n#\n#\nversion="0.01"\n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; uroot #debug \ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is ffind.sh, an extention of unix find.\n## This is released under GPL I\n## The syntax is:\n## - ffind.sh <date> <ext> - converts to html format\n## Where <date> = yyy/mm/dd \n## - ffind.sh <date> <date> - files in this directory between\n## These dates \n## - ffind.sh rename- rename resume files to upload names. \n## - ffind.sh dsply <file[doc,txt,pdf]> displays these three types\n## - ffind.sh upld - Uploads resume files to server. \n## in all of these, Output is delivered to the screen...\n## *** NOTE *** These commands need not be run as root!\n##\n## For structure information type "grep '^\s#\s*' ffind.sh"\n## :^)\n## (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n##\n# *****Documentation Loop ends here the rest is function******\n#\n} # Test: ffind.sh\n#\nfunction dummy(){\n#* function dummy - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test:\n#\n#\n######################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script does not need to run as root but that's OK as you are not root" 1>&2\nfi\n} # Test:~flint/bin/mtoc.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n# echo "mtoc.sh v"$version" starts"\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n#d ARGS=$# # carries the number of args into the functions...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause \nif [ "$#" -eq "2" ] && [ "$1" = "tw9y" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "upld" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "c2htm" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "c2txt" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "c2pdf" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "conv" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "rename" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "dsply" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#d echo $#" "$1" "$2" "$3" "$ARGS ;spause \n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; $1="help"; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") flint_short_vita_2017-07-01.odtdefvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. To TEST:\n#\n# echo " "; echo "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug echo "That's all folks!!"\n#\n#d rm -rf ss # removes super secret data file\n#* restore environment cd "$S"\n}}}
''25 March 2019''\n\nNeed to test this on several platforms for Kevin...\n\n{{{\n#!/bin/bash\n#\n# Base our actions on the OS we're running.\n# Cobbled together by Kevin Cole <kevin.cole@novawebdevelopment.org>\n2019.03.22 (kjc)\n#\n\nif [[ "$OSTYPE" == "linux-gnu" ]]; then\n # ...\n echo "I'm Linux, the best!"\nelif [[ "$OSTYPE" == "darwin"* ]]; then\n # Mac OSX\n echo "I'm Mac OS Sux!"\nelif [[ "$OSTYPE" == "cygwin" ]]; then\n # POSIX compatibility layer / Linux environment emulation for Windows\n echo "I'm almost reasonable: I'm CygWin"\nelif [[ "$OSTYPE" == "msys" ]]; then\n # Lightweight shell / GNU utilities compiled for Windows (part of MinGW)\n echo "I'm okay in a pinch: I'm MinGW"\nelif [[ "$OSTYPE" == "win32" ]]; then\n # I'm not sure this can happen.\n echo "Whose beautiful wife is this? I'm... Windows???"\nelif [[ "$OSTYPE" == "freebsd"* ]]; then\n # ...\n echo "I'm FreeBSD, the second-best!"\nelse\n # Unknown.\n echo "Cool! I'm the unknown soldier!"\nfi\n\n}}}
''25 March 2019''\n{{{\n#!/usr/bin/env bash\n# Note the difference above chocko...\n#\n# Base our actions on the OS we're running.\n# Cobbled together by Kevin Cole <kevin.cole@novawebdevelopment.org>\n# 2019.03.22 (kjc)\n# 03/25/2019 05:34:45 PM DTG & PF with consider smarminess\n\ncase "$OSTYPE" in\n "linux-gnu") echo "I'm Linux, the best!";; # ...\n "darwin"* ) echo "I'm Mac OS Sux!" ;; # Mac OSX\n "cygwin" ) echo "I'm almost reasonable: I'm CygWin" ;; # POSIX compatibility layer / Linux environment emulation for Windows\n "msys" ) echo "I'm okay in a pinch: I'm MinGW" ;; # Lightweight shell / GNU utilities compiled for Windows (part of MinGW)\n "win32" ) echo "I'm... Windows???" ;; # I'm not sure this can happen.\n "freebsd"* ) echo "I'm FreeBSD, the second-best!" ;; # ...\n * ) echo "Cool! I'm the unknown soldier!"; exit 1;; # Unknown.\nesac # End main loop. To TEST: OSTYPE="banana" ./sodrbdrgns.sh\n}}}
Type the text for '9 December 2019'\n\n[[Hour of Code|https://hourofcode.com/us/learn]]\n\n{{{\n> The Hour of Code <http://hourofcode.com/> has introduced over 100 million\nstudents in more than 180 countries to computer science. ACM (a partner of\nCode.org <http://code.org/>, a coalition of organizations dedicated to\nexpanding participation in computer science) encourages you to host an Hour\nof Code in your community and give students an opportunity to gain the\nskills needed for creating technology thatโs changing the world.\n> \n> Now in its fifth year, the Hour of Code is a global movement designed to\ngenerate excitement in young people about programming and technology. Games,\ntutorials, and other events are organized by local volunteers from schools,\nresearch institutions, and other groups during Computer Science Education\nWeek <http://csedweek.org/>, December 3-9.\n> \n> Anyone, anywhere can organize an Hour of Code event, and anyone from ages\n4 to 104 can try the one-hour tutorials <https://code.org/learn>, which are\navailable in more than 45 languages. Learn more about how to teach an Hour\nof Code <http://hourofcode.com/how-to>. Visit the Get Involved page\n<http://hourofcode.com/promote> for additional ideas for promoting your\nevent.\n\n}}}
Type the text for '18 February 2020'\n\n{{{\n#!/bin/bash\n# pflint\n# Tue Feb 18 07:54:40 EST 2020\n# SOURCE: https://forums.linuxmint.com/viewtopic.php?t=192477\n#\n# cinnamon-screensaver-command --lock --away-message "Put your message here"\n# ifconfig -a | grep 192.168 | cut -d ":" -f 2 |cut -d " " -f 1\nifconfig -a | grep 192.168 | cut -d ":" -f 2 |cut -d " " -f 1 | \s\nxargs cinnamon-screensaver-command --lock --away-message\n}}}
Type the text for '23 February 2020'\n\nhttps://wiki.bash-hackers.org/
Type the text for '18 January 2021'\n\n...A possible way to amuse and delight with a musical instrument is to use an ''echoplex'' as part of your performance.\n\n[[echoplex page|http://docbox.flint.com:8081/echoplex]]\n\n\n[[To find the MIDI control surface|http://docbox.flint.com:8081/geekland#WhatDoYouHaveHookedToYourUSB]]
Type the text for '4 May 2021'\n\nWe need a program that checks for conflict between named variables and reserved system calls. This may need to run upon interpretation...\n\n
Type the text for '8 November 2021'\n\n[[Bash Background Processes|https://spin.atomicobject.com/2017/08/24/start-stop-bash-background-process/]]
Type the text for '3 March 2022'\n\n\n{{{\n#!/usr/bin/env bash \n# Thu 03 Mar 2022 09:40:27 AM EST pflint\nversion="0.027"\n#\nneed="git"\n# need="sphinx-common sphinx-doc python-sphinx git pv apache2" #D banana # programs you need put here\n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; uroot #deb\n#\ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is new-website.sh, an extention of unix find.\n## This is released under GPL I\n## The syntax is:\n## - new-website.sh sane - Checks that you have the stuff you need. \n## - new-website.sh See2do - Shows you what you need to fix. \n## - new-website.sh gitset <dir> - Sets up a git based development environment \n## - new-website.sh <date> <ext> - does something cool\n## Where <date> = yyy/mm/dd \n## - new-website.sh gupdate - updates your git repository. \n## - new-website.sh dsply <file[doc,txt,pdf]> displays these three types\n## in all of these, Output is delivered to the screen...\n## *** NOTE *** These commands need not be run as root, but installing sane code!\n##\n## For structure information type "grep '^\s#\s*' new-website.sh"\n#\n} # Test: new-website.sh help \n#\nfunction dummy(){\n#* function dummy - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: new-website.sh dummy\n#\n#\nfunction See2do(){\n#* function See2do - Notionally lists what you need to complete\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\necho "You need to rewrite the menu in a manner that is functional"\necho "Add a function which sets up the git environment the way you want it"\necho "Add a function which checks for proper braces"\necho "Add a function that puts this program in the path"\nspause\n} # Test: new-website.sh See2do\n#\nfunction gitset(){\n#* function gitset - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# uroot\necho " the name of the directory you are setting up is: "$var2\nspause\nPROJ=$var2 cd $PROJ\n git init\n echo "*~" >> .gitignore\n echo "*.swp" >> .gitignore\n echo "*.swo" >> .gitignore\n echo "*.tmp" >> .gitignore\n echo "*.sql" >> .gitignore\n echo "*.zip" >> .gitignore\n echo "*.tgz" >> .gitignore\n echo "*.tar.gz" >> .gitignore\n echo "*/sites/default/files" >> .gitignore\n echo "*/sites/default/settings.php" >> .gitignore\n echo "*/sites/default/civicrm.settings.php" >> .gitignore\n git add .gitignore\n git commit -m "Begin."\n git add .\n git commit -m "Track files."\n} # Test: new-website.sh gitset banana\n#\nfunction PlainDrupal(){\n#* function PlainDrupal - apparently installs a drupal instance. ?please expand?\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot #F do you need root?\necho "note that $opt and $PROJ are not yet defined..."\necho "type in 'opt' ";read opt\necho "type in 'PROJ' ";read PROJ\necho "are these correct? "$opt, $PROJ\nspause\nbreak\necho "installing $opt into $PROJ"\necho " I have no idea what we do now..."\necho "I presume that this next line..." \necho "composer create-project drupal/recommended-project:8.x $PROJ"\ninit_git_and_ddev\ncomposer require drupal/admin_toolbar\n# @TODO drush enables\nddev exec drush site-install --yes\nddev exec drush en -y admin_toolbar_tools\n} # Test: new-website.sh PlainDrupal\n#\n#\n######################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script does not need to run as root but that's OK as you are not root" 1>&2\nfi\n} # Test:~flint/bin/mtoc.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\n#* check location of vital files and programs, sanity check\nfunction sane(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nrm -rf need > /dev/null\nfor prog in $need\ndo\n # echo $prog\n # Better SOURCE:https://www.cyberciti.biz/faq/find-out-if-package-is-installed-in-linux/\n answer=$(echo $(dpkg-query -W -f='${Status} ${Version}\sn' $prog)| cut -d " " -f 3)\n # echo $answer \n if [ "$answer" != "installed" ];\n then\n echo $prog >> need\n #debug echo "Type \s"sudo apt-get install $prog\s" to fix this."\n #debug spause\n # exit 0\n fi\ndone\n#D clear\necho "Welcome to $0!"\n# uroot\necho "Missing programs:"\n if [ -f need ];\n then\n echo " This program needs the following program(s) to be installed on this system."\n cat need |while read line; do echo -e \s\st" - " $line; done\n if [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2\n echo "You want them installed if you are root they will install"\n echo "Leaving this function without installing anything"\n exit\n fi\n spause\n cat need |while read line; do \n echo "apt-get --yes install $line"\n apt-get --yes install $line \n done\n #D \n rm -rf need\n exit 0 # breaks you out of loop...\n else\n echo " * None * Looks like the pot's right, lets play!"\n fi\n#\necho "end of check"\n} # Test: new-website.sh sane\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n#d ARGS=$# # carries the number of args into the functions...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause \nif [ "$#" -eq "1" ] && [ "$1" = "PlainDrupal" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "Crunchy" ]; then ARGS="*"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "Replace" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "These" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "With " ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "Your" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "Functions" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "GotIt?" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "See2do" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "gitset" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "sane" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause \n#\n#* Dispatcher Routing\n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; $1="help"; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") flint_short_vita_2017-07-01.odtdefvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. TEST: ?fill in test?\n#\n# echo " "; echo "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug echo "That's all folks!!"\n#\n#* restore environment cd "$S"\n}}}\n\n
Type the text for '3 March 2022'\n\n\n{{{\n#!/usr/bin/env bash \n# Thu 03 Mar 2022 09:40:27 AM EST pflint\nversion="0.001"\n#\n# programs you need put here\nneed="git libsecret-tools pv " #D add "banana" to ntest \n# need="sphinx-common sphinx-doc python-sphinx git pv apache2" \n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; uroot #deb\n#\ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is gitbrain.sh, an extention of unix find.\n## This is released under GPL I\n## The syntax is:\n## - gitbrain.sh sane - Checks that you have the stuff you need. \n## - gitbrain.sh See2do - Shows you what you need to fix. \n## - gitbrain.sh briget - Check your braces... \n## - gitbrain.sh gitset <dir> - Sets up a git based development environment \n## Where <dir> = ["." (= default unless specified)]\n## - gitbrain.sh <date> [ext] - Shows revision history\n## Where <date> = yyyy/mm/dd \n## Where <ext> = [any valid part of name (optional)]\n## - gitbrain.sh gupdate [dir] - updates your git repository. \n## Where [dir] = [. (unless specified)]\n## - gitbrain.sh dsply <ext> \n## Where <ext>=<file[doc,txt,pdf]> displays these three types\n## - gitbrain.sh difsply <ext1> <ext2> \n## in all of these, Output is delivered to the screen...\n## *** NOTE *** These commands need not be run as root, but installing sane code!\n##\n## For structure information type "grep '^\s#\s*' gitbrain.sh"\n#\n} # Test: gitbrain.sh help \n#\nfunction dummy(){\n#* function dummy - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: gitbrain.sh dummy\n#\nfunction briget(){\n#* function briget - Rename and fill stuff in between braces\nclear; echo "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\ncat -n gitbrain.sh |while read line; \ndo echo $line\nif [[ "$line" == *{* ]]; then\n echo "{" START \n i=$((i+1))\n# else\n # echo "}" was not found\nfi\nif [[ "$line" == *}* ]]; then\n echo "}" STOP; PAIR=1\n i=$((i-1))\nfi\n\ndone\n# uroot\n} # Test: gitbrain.sh dummy\n#\n\nfunction See2do(){\nclear\n#* function See2do - Notionally lists what you need to complete\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\necho "You need to rewrite the menu in a manner that is functional"\necho "Add a function which sets up the git environment the way you want it"\necho "Add a function which checks for proper braces (briget)"\necho "Add a function that puts this program in the path"\nspause\n} # Test: gitbrain.sh See2do\n#\nfunction gitset(){\n#* function gitset - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# uroot\necho " the name of the directory you are setting up is: "$var2\nspause\nPROJ=$var2 cd $PROJ\n git init\n echo "*~" >> .gitignore\n echo "*.swp" >> .gitignore\n echo "*.swo" >> .gitignore\n echo "*.tmp" >> .gitignore\n echo "*.sql" >> .gitignore\n echo "*.zip" >> .gitignore\n echo "*.tgz" >> .gitignore\n echo "*.tar.gz" >> .gitignore\n echo "*/sites/default/files" >> .gitignore\n echo "*/sites/default/settings.php" >> .gitignore\n echo "*/sites/default/civicrm.settings.php" >> .gitignore\n git add .gitignore\n git commit -m "Begin."\n git add .\n git commit -m "Track files."\n} # Test: gitbrain.sh gitset banana\n#\nfunction PlainDrupal(){\n#* function PlainDrupal - apparently installs a drupal instance. ?please expand?\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot #F do you need root?\necho "note that $opt and $PROJ are not yet defined..."\necho "type in 'opt' ";read opt\necho "type in 'PROJ' ";read PROJ\necho "are these correct? "$opt, $PROJ\nspause\nbreak\necho "installing $opt into $PROJ"\necho " I have no idea what we do now..."\necho "I presume that this next line..." \necho "composer create-project drupal/recommended-project:8.x $PROJ"\ninit_git_and_ddev\ncomposer require drupal/admin_toolbar\n# @TODO drush enables\nddev exec drush site-install --yes\nddev exec drush en -y admin_toolbar_tools\n} # Test: gitbrain.sh PlainDrupal\n#\n#\n######################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script does not need to run as root but that's OK as you are not root" 1>&2\nfi\n} # Test:~flint/bin/mtoc.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\n#* check location of vital files and programs, sanity check\nfunction sane(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nrm -rf need > /dev/null\nfor prog in $need\ndo\n # echo $prog\n # Better SOURCE:https://www.cyberciti.biz/faq/find-out-if-package-is-installed-in-linux/\n answer=$(echo $(dpkg-query -W -f='${Status} ${Version}\sn' $prog)| cut -d " " -f 3)\n # echo $answer \n if [ "$answer" != "installed" ];\n then\n echo $prog >> need\n #debug echo "Type \s"sudo apt-get install $prog\s" to fix this."\n #debug spause\n # exit 0\n fi\ndone\n#D clear\necho "Welcome to $0!"\n# uroot\necho "Missing programs:"\n if [ -f need ];\n then\n echo " This program needs the following program(s) to be installed on this system."\n cat need |while read line; do echo -e \s\st" - " $line; done\n if [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2\n echo "You want them installed if you are root they will install"\n echo "Leaving this function without installing anything"\n exit\n fi\n spause\n cat need |while read line; do \n echo "apt-get --yes install $line"\n apt-get --yes install $line \n done\n #D \n rm -rf need\n exit 0 # breaks you out of loop...\n else\n echo " * None * Looks like the pot's right, lets play!"\n fi\n#\necho "end of check"\n} # Test: gitbrain.sh sane\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n#d ARGS=$# # carries the number of args into the functions...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause \nif [ "$#" -eq "1" ] && [ "$1" = "PlainDrupal" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "Crunchy" ]; then ARGS="*"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "Replace" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "These" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "With " ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "Your" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "Functions" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "GotIt?" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "See2do" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "briget" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "gitset" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "sane" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause \n#\n#* Dispatcher Routing\n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; $1="help"; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") flint_short_vita_2017-07-01.odtdefvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. TEST: ?fill in test?\n#\n# echo " "; echo "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug echo "That's all folks!!"\n#\n#* restore environment cd "$S"\n}}}
Type the text for '3 March 2022'\n\n{{{\n#!/usr/bin/env bash \n# Thu 03 Mar 2022 09:40:27 AM EST pflint\nversion="0.06"\n#\n# programs you need put here\nneed="git libsecret-tools pv " #D add "banana" to ntest \n# need="sphinx-common sphinx-doc python-sphinx git pv apache2" \n#\n# GIT SOURCE: https://gist.github.com/alexpchin/dc91e723d4db5018fef8\n# git --version # to check git version\n# git config --global user.name "Paul Flint"\n# git config --global user.email "flint@flint.com"\n# git config --global --list\n# git status # important\n# cd repository\n# touch README.md\n# git init\n# git add README.md\n# git commit -m "first commit"\n# git remote add origin git@github.com:alexpchin/<reponame>.git\n# git push -u origin master\n# git config --global user.name "Paul Flint"\n# git config --global user.email "flint@flint.com"\n# https://github.com/settings/keys\n# ssh-keygen -t rsa -C "flint@flint.com" ; copied key using gui\n#\n#* function help - Help function for template basic help goes here\nfunction help(){ \necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; uroot #deb\n#\ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is gitbrain.sh, an extention of unix find.\n## This is released under GPL I\n## The syntax is:\n## - gitbrain.sh sane - Checks that you have the stuff you need. \n## - gitbrain.sh See2do - Shows you what you need to fix. \n## - gitbrain.sh briget [file] - Checks your braces, where...\n## [file] = [any valid vb file name (if not included checks itself)]\n## - gitbrain.sh select - An example of select where... \n## - gitbrain.sh gitset <dir> - Sets up a git based development environment \n## <dir> = ["." (= default unless specified)]\n## - gitbrain.sh <date> [ext] - Shows revision history where...\n## <date> = yyyy/mm/dd \n## <ext> = [any valid part of name (optional)]\n## - gitbrain.sh gupdate [dir] - updates your git repository. \n## [dir] = [. (unless specified)]\n## - gitbrain.sh dsply <ext> where...\n## <ext>=<file[doc,txt,pdf]> displays these three types\n## - gitbrain.sh difsply <ext1> <ext2> where... \n## in all of these, Output is delivered to the screen...\n## *** NOTE *** , except installing code in sane, commands need not be run as root\n##\n## For structure information type "grep '^\s#\s*' gitbrain.sh"\n#\n} # Test: gitbrain.sh help \n#\nfunction dummy(){\n#* function dummy - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: gitbrain.sh dummy\n#\nfunction gitset(){\n#* function gitset - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: gitbrain.sh gitset\n#\n#\nfunction difsply(){\n#* function difsply - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: gitbrain.sh difsply\n\n#\nfunction dsply(){\n#* function dsply - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: gitbrain.sh dsply\n#\n#\nfunction select(){\n#* function select - Example of a select function\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# uroot\necho "Type the letter for the fruit"\necho " 1. Banana"\necho " 2. Apple"\necho "Please choose 1 or 2 >" \nread ans\ncase "$ans" in\n "1") echo "Banana" ;;\n "2") echo "Apple" ;;\n *) echo "Wrong" ;; # Anything else run help and exit...\nesac \n} # Test: gitbrain.sh select\n#\nfunction briget(){\n#* function briget - Checks the braces in a visual bash function\nclear; echo "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\nob=$(echo -e '\sx7b')\ncb=$(echo -e '\sx7d')\n\nif [ "$ARGS" -eq "1" ]; then target="gitbrain.sh"; fi\nif [ "$ARGS" -eq "2" ]; then target=$var2; fi\n# echo $ARGS, $target; spause\ncat -n $target |while read line; \ndo echo $line\n# while $FUNCNAME != "briget" \n# do\n# if [[ "$line" == *$ob* ]] && [[ "$line" != "*'/*$ob/*'*" ]] ; then\nif [[ "$line" == *$ob* ]] ; then\n # echo "$ob" FSTART \n echo "$ob" FSTART \n i=$((i+1))\n # else\n # echo "$ob" was not found\n fi\n if [[ "$line" == *$cb* ]] ; then\n # if [[ "$line" == *$cb* ]] && [[ "$line" != "*'/*$cb/*'*" ]] ; then\n echo "$cb" FEND; PAIR=1\n i=$((i-1))\n fi\n# done # test name\n #\ndone\n# uroot\n} # Test: gitbrain.sh dummy\n#\n\nfunction See2do(){\nclear\n#* function See2do - Notionally lists what you need to complete\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\necho "You need to rewrite the menu in a manner that is functional"\necho "Add a function which sets up the git environment the way you want it"\necho "Add a function which checks for proper braces (briget)"\necho "Add a function that puts this program in the path"\nspause\n} # Test: gitbrain.sh See2do\n#\nfunction gitset(){\n#* function gitset - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# uroot\necho " the name of the directory you are setting up is: "$var2\nspause\nPROJ=$var2 cd $#* function help - Help function for template basic help goes here\n#* function dummy - Rename and fill stuff in between braces\n#* function gitset - Rename and fill stuff in between braces\n#* function difsply - Rename and fill stuff in between braces\n#* function dsply - Rename and fill stuff in between braces\n#* function select - Example of a select function\n#* function briget - Checks the braces in a visual bash function\n#* function See2do - Notionally lists what you need to complete\n#* function gitset - Rename and fill stuff in between braces\n#* function PlainDrupal - apparently installs a drupal instance. ?please expand?\n#* function uroot - Checks to see if you are root\n#* function spause - A simple tarry...\n#* check location of vital files and programs, sanity check\nPROJ\n git init\n echo "*~" >> .gitignore\n echo "*.swp" >> .gitignore\n echo "*.swo" >> .gitignore\n echo "*.tmp" >> .gitignore\n echo "*.sql" >> .gitignore\n echo "*.zip" >> .gitignore\n echo "*.tgz" >> .gitignore\n echo "*.tar.gz" >> .gitignore\n echo "*/sites/default/files" >> .gitignore\n echo "*/sites/default/settings.php" >> .gitignore\n echo "*/sites/default/civicrm.settings.php" >> .gitignore\n git add .gitignore\n git commit -m "Begin."\n git add .\n git commit -m "Track files."\n} # Test: gitbrain.sh gitset banana\n#\nfunction PlainDrupal(){\n#* function PlainDrupal - apparently installs a drupal instance. ?please expand?\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot #F do you need root?\necho "note that $opt and $PROJ are not yet defined..."\necho "type in 'opt' ";read opt\necho "type in 'PROJ' ";read PROJ\necho "are these correct? "$opt, $PROJ\nspause\nbreak\necho "installing $opt into $PROJ"\necho " I have no idea what we do now..."\necho "I presume that this next line..." \necho "composer create-project drupal/recommended-project:8.x $PROJ"\ninit_git_and_ddev\ncomposer require drupal/admin_toolbar\n# @TODO drush enabI'd like to skip the tiddlywiki altogether if possibleles\nddev exec drush site-install --yes\nddev exec drush en -y admin_toolbar_tools\n} # Test: gitbrain.sh PlainDrupal\n#\n#\n######################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script does not need to run as root but that's OK as you are not root" 1>&2\nfi\n} # Test:~flint/bin/mtoc.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\n#* check location of vital files and programs, sanity check\nfunction sane(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nrm -rf need > /dev/null\nfor prog in $need\ndo\n # echo $prog\n # Better SOURCE:https://www.cyberciti.biz/faq/find-out-if-package-is-installed-in-linux/\n answer=$(echo $(dpkg-query -W -f='${Status} ${Version}\sn' $prog)| cut -d " " -f 3)\n # echo $answer \n if [ "$answer" != "installed" ];\n then\n echo $prog >> need\n #debug echo "Type \s"sudo apt-get install $prog\s" to fix this."\n #debug spause\n # exit 0\n fi\ndone\n#D clear\necho "Welcome to $0!"\n# uroot\necho "Missing programs:"\n if [ -f need ];\n then\n echo " This program needs the following program(s) to be installed on this system."\n cat need |while read line; do echo -e \s\st" - " $line; done\n if [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2\n echo "You want them installed if you are root they will install"\n echo "Leaving this function without installing anything"\n exit\n fi\n spause\n cat need |while read line; do \n echo "apt-get --yes install $line"\n apt-get --yes install $line \n done\n #D \n rm -rf need\n exit 0 # breaks you out of loop...\n else\n echo " * None * Looks like the pot's right, lets play!"\n fi\n#\necho "end of check"\n} # Test: gitbrain.sh sane\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n#d ARGS=$# # carries the number of args into the functions...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause \nif [ "$#" -eq "1" ] && [ "$1" = "PlainDrupal" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "Crunchy" ]; then ARGS="*"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "Replace" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "These" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "With " ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "Your" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "Functions" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "GotIt?" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "gitset" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "See2do" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "briget" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "briget" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "select" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "sane" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause \n#\n#* Dispatcher Routing\n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; $1="help"; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") flint_short_vita_2017-07-01.odtdefvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. TEST: ?fill in test?\n#\n# echo " "; echo "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug echo "That's all folks!!"\n#\n#* restore environment cd "$S"\n\n}}}
2022-03-07\n\nREADME.md\n\n[[gitbrain.sh]] is a shell script for helping programmers (specifically me) develop more and better chops with git.
Type the text for '21 March 2022'\n\n{{{\n#!/usr/bin/env bash \n# Tue 15 Mar 2022 07:15:17 PM EDT pflint\nversion="0.026"\n#\n# programs you need put here\nneed="git libsecret-tools pv " #D add "banana" to ntest samuf\n# need="sphinx-common sphinx-doc python-sphinx git pv apache2" \n#\n#* function help - Help function for template basic help goes here\nfunction help(){ \necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; uroot #deb\n#\ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is samuf.sh, an extention of unix find.\n## This is released under GPL I\n## The syntax is:\n## - samuf.sh sane - Checks that you have the stuff you need. \n## - samuf.sh see2do - Shows you what you need to fix. \n## - samuf.sh briget [file] - Checks your braces, where...\n## [file] = [any valid vb file name (if not included [file]=$0)]\n## (hint suffix this command with "| less -S")\n## - samuf.sh vbzld [file] - Brings file down from Zope Visual Bash \n## - samuf.sh flink [file]- Symlinks [file] & [file].sh into $PATH\n## - samuf.sh flunk [file]- Un-Symlinks [file] & [file].sh into $PATH\n## \n## in all of these, Output is delivered to the screen...\n## *** NOTE *** , except installing code in sane, commands need not be run as root\n##\n## For structure information type "grep '^\s#\s*' samuf.sh"\n#\n} # Test: samuf.sh help \n##\n#\n#\nfunction dummy(){\n#* function dummy - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: samuf.sh dummy\n#\n#\n######################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\nfunction dummy(){\n#* function dummy - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: samuf.sh dummy\n#\n#\nfunction vbzld(){\n#* function vbzld - Downloads and prepares a Zope Visual Bash file\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\nspause\nset up directory mkdir -p ~/GrowBot/bin/\ncd ~/GrowBot/bin/\nmv gbot.sh obe/$(date +%F)_gbot.sh\nwget http://docbox.flint.com:8081/grobot/tiddlers/gbot.sh\nsed -i '1,3d' gbot.sh # removes top three lines #fix this with a loop...\nhead -n -3 gbot.sh # removes bottom three lines\nchmod +x gbot.sh\nbackkup gbot.sh\nedit gbot.sh\nchmod +x gbot.sh\nsudo\necho $PATH |cut -d ":" \n} # Test: samuf.sh dummy\n#\n#\n#\nfunction briget(){\n#* function briget - Checks the braces in a visual bash function\nclear; echo "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\nob=$(echo -e '\sx7b')\ncb=$(echo -e '\sx7d')\n\nif [ "$ARGS" -eq "1" ]; then target="$0"; fi\nif [ "$ARGS" -eq "2" ]; then target=$var2; fi\n# echo $ARGS, $target; spause\ncat -n $target |while read line; \ndo echo $line\n# while $FUNCNAME != "briget" \n# do\n# if [[ "$line" == *$ob* ]] && [[ "$line" != "*'/*$ob/*'*" ]] ; then\nif [[ "$line" == *$ob* ]] ; then\n # echo "$ob" FSTART \n echo "$ob" FSTART \n i=$((i+1))\n # else\n # echo "$ob" was not found\n fi\n if [[ "$line" == *$cb* ]] ; then\n # if [[ "$line" == *$cb* ]] && [[ "$line" != "*'/*$cb/*'*" ]] ; then\n echo "$cb" FEND; PAIR=1\n i=$((i-1))\n fi\n# done # test name\n #\ndone\n# uroot\n} # Test: samuf.sh dummy\n#\nfunction see2do(){\nclear\n#* function see2do - Notionally lists what you need to complete\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#\necho "You need to rewrite the menu in a manner that is functional"\necho "Add a function which sets up the git environment the way you want it"\necho "Add a function which checks for proper braces (briget)"\necho "Add a function that puts this program in the path"\nspause\n} # Test: samuf.sh See2do\n#\nfunction sane(){\n#* function sane - check location of vital files and programs, sanity check\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nrm -rf need > /dev/null\nfor prog in $need\ndo\n # echo $prog\n # Better SOURCE:https://www.cyberciti.biz/faq/find-out-if-package-is-installed-in-linux/\n answer=$(echo $(dpkg-query -W -f='${Status} ${Version}\sn' $prog)| cut -d " " -f 3)\n # echo $answer \n if [ "$answer" != "installed" ];\n then\n echo $prog >> need\n #debug echo "Type \s"sudo apt-get install $prog\s" to fix this."\n #debug spause\n # exit 0\n fi\ndone\n#D clear\necho "Welcome to $0!"\n# uroot\necho "Missing programs:"\n if [ -f need ];\n then\n echo " This program needs the following program(s) to be installed on this system."\n cat need |while read line; do echo -e \s\st" - " $line; done\n if [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2\n echo "You want them installed if you are root they will install"\n echo "Leaving this function without installing anything"\n exit\n fi\n spause\n cat need |while read line; do \n echo "apt-get --yes install $line"\n apt-get --yes install $line \n done\n #D \n rm -rf need\n exit 0 # breaks you out of loop...\n else\n echo " * None * Looks like the pot's right, lets play!"\n fi\n#\necho "end of check"\n} # Test: samuf.sh sane\n#\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script does not need to run as root but that's OK as you are not root" 1>&2\nelse\n # echo " * None * Looks like the pot's right, lets play!"\n echo " You are ROOT so get outa root"\nfi\n} # Test:~flint/bin/mtoc.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\nfunction flink(){\n#* function flink - Adds adds two symlinks to public\n# This function, which runs as root, will make the program, \n# which must end in sh executable and then\n# then the function adds two symlinks to the first element\n# of the $PATH variable linking the argument and the argument suffixed with "sh"\n# both linked to the second script element (hopefully /usr/local/bin).\n# echo "into root"\n# sudo bash\n# echo "outa root"\nuroot\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# break\n# Note user must be "$USER", fix in 2.0\n# trap "set +x; sleep 5; set -x" DEBUG\nHMDIR=$(pwd) # echo $HMDIR\nFNAME=$var2\necho $FNAME\nspause\n# echo $PWD | cut -d ":" -f 3\nLKDIR="/usr/local/sbin"\necho $LKDIR\nspause\necho "removing "$HMDIR"/fu.sh"; rm $HMDIR/fu.sh 2>/dev/null\ncd $HMDIR\npwd\necho '#!/bin/bash' >> fu.sh\necho 'echo "fuck you Eric" ' >> fu.sh\nchmod +x fu.sh \n./fu.sh \necho $PATH\nls -alt $HMDIRs\ncd $LKDIR\nsudo ln -s $HMDIR/fu.sh .\nfu.sh \nsudo ls -alt $LKDIR/fu.sh\ncd ~\necho -n "keep in mind you are in your home directory now..."\nfu.sh\nspause\n} # Test: samuf.sh dummy\n#\n#\nfunction flunk(){\n#* function flunk - Un-Symlinks [file] & [file].sh into $PATH\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\necho "rm fu.sh /usr/local/sbin/fu.sh -Do This?"\nspause\nsudo rm fu.sh /usr/local/sbin/fu.sh\n} # Test: samuf.sh flunk\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n#d ARGS=$# # carries the number of args into the functions...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause \nif [ "$#" -eq "1" ] && [ "$1" = "flink" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "flink" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "see2do" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "vbzld" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "briget" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "briget" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "flunk" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "sane" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause \n#\n#* Dispatcher Routing\n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; $1="help"; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") defvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. TEST: ?fill in test?\n#\n# echo " "; echo "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug echo "That's all folks!!"\n#\n#* restore environment cd "$S"\n\n}}}
Type the text for '4 July 2022'\n\nEventually there will be sample code based upon Kevin's excellent work this Independence Day, based upon [[Home Assistant Sonoff based systems|http://docbox.flint.com:8081/ha/#CurlControl]].
Type the text for '23 August 2022'\n\nThis ugly thing needs to be tamed...\n\n{{{\n#!/bin/bash\n# Sat 14 Nov 2020 10:55:56 AM EST\n# Mon 14 Dec 2020 04:13:38 PM EST\n# Tue 23 Aug 2022 06:53:05 PM EDT \n#\n# pflint\necho "writing packages_$(date +%F)"\ndpkg --get-selections > packages_$(date +%F)\n#\n# set alias\n#\n#b apt-get install openssh-server\ncd ~\nwget http://docbox.flint.com/~flint/bin/.bash_aliases\n#\n# fix touchpad\n# tpi.sh\n#\n# backup home to usb drive\n# navigate to usb drive\n# run this:rsync -avr /home .\n#\n# apt-get install openssh-server\n# apt-get install gparted\n# apt-get install pluma\n# apt-get install nautilus\n# symlink pluma to gedit\n# cd /usr/bin\n# mv gedit gedit.org\n# ln -s pluma gedit\n#\n# install bookmarks and relink for nautilus\n# scp flint@trantor.local:./.gtk-bookmarks ~/.\s\n# mkdir -p /home/flint/.config/gtk-3.0/obe\n# mv /home/flint/.config/gtk-3.0/bookmarks /home/flint/.config/gtk-3.0/obe/$(date +%F)_bookmarks\n# ln -s /home/flint/.gtk-bookmarks /home/flint/.config/gtk-3.0/bookmarks\n# ls -alt /home/flint/.config/gtk-3.0/bookmarks\n# ln -s /home/flint/.gtk-bookmarks /home/flint/.config/gtk-3.0/bookmarks\n# scp flint@trantor.local:./.gtk-bookmarks /home/flint/.\n# mkdir -p /home/flint/.config/gtk-3.0/obe\n# mv bookmarks obe/$(date +%F)_bookmarks\n#\n# install bonjour\n# apt-get install avahi-daemon avahi-utils avahi-discover\n# service avahi-daemon restart\n#\n# Fix Tablet\n# https://www.linuxquestions.org/questions/linux-newbie-8/touch-screen-activation-in-ubuntu-15-10-lts-on-panasonic-toughbook-cf-29-mark-v-4175560322/\n#\n# https://www.bobjohnson.com/blog/giving-an-old-toughbook-a-new-lease-on-life-with-linux/\n#\n#https://www.youtube.com/watch?v=pIvWTH8L0Fk\n#\n#\n#https://www.ebay.com/sch/i.html?_from=R40&_trksid=pmkdir -p /home/flint/.config/gtk-3.0/obe2334524.m570.l1313&_nkw=home+elevator+lift&_sacat=0&LH_TitleDesc=0&_osacat=0&_odkw=home+elevator+kit\n#\n#\n#https://www.youtube.com/watch?v=CgdsamzPN8w\n#\n#https://search.yahoo.com/yhs/search?hspart=ddc&hsimp=yhs-linuxmint&type=__alt__ddc_linuxmint_com&p=unistrut+elevator\n#\n#\n#\n\n\n\n\n}}}
Type the text for '15 September 2022'\n\n{{{\n#!/bin/bash\nversion="0.012"\n#\n# Wed 24 Aug 2022 03:12:12 PM EDT \n# pflint\n#\nfunction help(){\n#* function help - Help function for template basic help goes here\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; uroot #deb\n#\ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is cinagrade2.sh, an extention of unix find.\n## This is released under GPL I\n## The syntax is:\n## - cinagrade2.sh sane - Checks that you have the stuff you need. \n## - cinagrade2.sh bupdate - update packages and backup package file. \n## - cinagrade2.sh setalias - Sets up a git based development environment \n## - cinagrade2.sh bu2usb - Backup to USB\n## - cinagrade2.sh <date> <ext> - does something cool\n## Where <date> = yyy/mm/dd \n## - cinagrade2.sh gupdate - updates your git repository. \n## - cinagrade2.sh dsply <file[doc,txt,pdf]> displays these three types\n## in all of these, Output is delivered to the screen...\n## *** NOTE *** These commands need not be run as root, but installing sane code!\n##\n## For structure information type "grep '^\s#\s*' cinagrade2.sh"\n#\n} # Test: cinagrade2.sh help \n#\n#\nfunction dummy(){\n#* function dummy - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: cinagrade2.sh dummy\n#\n#\nfunction bupdate(){\n#* function bupdate - Updates package lists & backups packages\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n# update packages\necho "Now you need root"\nsudo apt-get update\n#\n# now update package file\necho "writing packages_$(date +%F)"\ndpkg --get-selections > packages_$(date +%F)\n#\nclear\necho "To restore packages try this:"\necho " ls -alt | grep packages"\necho " dpkg --set-selections < packages"\necho " apt-get dselect-upgrade"\n#\n} # Test: cinagrade2.sh bupdate\n#\n#\nfunction setalias(){\n#* function setalias - sets the alias features we like\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n# set alias\n#\ncd ~\nmkdir -p ~/obe\ncp .bash_aliases obe/$(date +%F)_.bash_aliases\nwget http://docbox.flint.com/~flint/bin/.bash_aliases\n} # Test: cinagrade2.sh setalias\n#\n#\nfunction bu2usb(){\n#* function bu2usb - backs up home directory to usb\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: cinagrade2.sh dummy\n#\n# backup home to usb drive\n# navigate to usb drive\n# run this:rsync -avr /home .\n#\n#\n# symlink pluma to gedit\n# cd /usr/bin\n# mv gedit gedit.org\n# ln -s pluma gedit\n#\n# install bookmarks and relink for nautilus\n# scp flint@trantor.local:./.gtk-bookmarks ~/.\s\n# mkdir -p /home/flint/.config/gtk-3.0/obe\n# mv /home/flint/.config/gtk-3.0/bookmarks /home/flint/.config/gtk-3.0/obe/$(date +%F)_bookmarks\n# ln -s /home/flint/.gtk-bookmarks /home/flint/.config/gtk-3.0/bookmarks\n# ls -alt /home/flint/.config/gtk-3.0/bookmarks\n# ln -s /home/flint/.gtk-bookmarks /home/flint/.config/gtk-3.0/bookmarks\n# scp flint@trantor.local:./.gtk-bookmarks /home/flint/.\n# mkdir -p /home/flint/.config/gtk-3.0/obe\n# mv bookmarks obe/$(date +%F)_bookmarks\n#\n# install bonjour\n# apt-get install avahi-daemon avahi-utils avahi-discover\n# service avahi-daemon restart\n#\n# Fix Tablet\n# https://www.linuxquestions.org/questions/linux-newbie-8/touch-screen-activation-in-ubuntu-15-10-lts-on-panasonic-toughbook-cf-29-mark-v-4175560322/\n#\n# https://www.bobjohnson.com/blog/giving-an-old-toughbook-a-new-lease-on-life-with-linux/\n#\n#https://www.youtube.com/watch?v=pIvWTH8L0Fk\n#\n#\n#https://www.ebay.com/sch/i.html?_from=R40&_trksid=pmkdir -p /home/flint/.config/gtk-3.0/obe2334524.m570.l1313&_nkw=home+elevator+lift&_sacat=0&LH_TitleDesc=0&_osacat=0&_odkw=home+elevator+kit\n#\n#\n#https://www.youtube.com/watch?v=CgdsamzPN8w\n#\n#https://search.yahoo.com/yhs/search?hspart=ddc&hsimp=yhs-linuxmint&type=__alt__ddc_linuxmint_com&p=unistrut+elevator\n#\n#\n#####################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script does not need to run as root but that's OK as you are not root" 1>&2\nfi\n} # Test:~flint/bin/mtoc.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\nfunction sane(){\n#* function sane - check location of vital files and programs, sanity check\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nrm -rf need > /dev/null\nfor prog in openssh-server gparted nautilus pluma git \n#d ;do echo $prog; done\n#D banana # programs you need put here\ndo\n # echo $prog\n # Better SOURCE:https://www.cyberciti.biz/faq/find-out-if-package-is-installed-in-linux/\n answer=$(echo $(dpkg-query -W -f='${Status} ${Version}\sn' $prog)| cut -d " " -f 3)\n # echo $answer \n if [ "$answer" != "installed" ];\n then\n echo $prog >> need\n #debug echo "Type \s"sudo apt-get install $prog\s" to fix this."\n #debug spause\n # exit 0\n fi\ndone\n#D clear\necho "Welcome to $0!"\n# uroot\necho "Missing programs:"\n if [ -f need ];\n then\n echo " This program needs the following program(s) to be installed on this system."\n cat need |while read line; do echo -e \s\st" - " $line; done\n if [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2\n echo "You want them installed if you are root they will install"\n echo "Leaving this function without installing anything"\n exit\n fi\n spause\n cat need |while read line; do \n echo "apt-get --yes install $line"\n apt-get --yes install $line \n done\n #D \n rm -rf need\n exit 0 # breaks you out of loop...\n else\n echo " * None * Looks like the pot's right, lets play!"\n fi\n#\necho "end of check"\n} # Test: cinagrade2.sh sane\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n#d ARGS=$# # carries the number of args into the functions...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause \nif [ "$#" -eq "1" ] && [ "$1" = "update" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "bupdate" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "bu2usb" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "setalias" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "sane" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause \n#\n#* Dispatcher Routing\n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; $1="help"; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") flint_short_vita_2017-07-01.odtdefvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. TEST: ?fill in test?\n#\n# echo " "; echo "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug echo "That's all folks!!"\n#\n#* restore environment cd "$S"\n}}}
{{{\n#!/bin/bash\nversion="0.04"\n#\n# pflint\n#\n# Tue 15 Nov 2022 12:32:49 PM EST added fix to nautilus\n# Tue 27 Dec 2022 01:06:14 PM EST added bufrusb new function\n#\nfunction help(){\n#* function help - Help function for template basic help goes here\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; uroot #deb\n#\ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is finagrade.sh, an extention of unix find.\n## Theis is released under GPL I\n## The syntax is:\n## - finagrade.sh sane - Checks that you have the stuff you need. \n## - finagrade.sh flink - Patches to current user path. \n## - finagrade.sh flunk - Removes from current user path. \n## - finagrade.sh adalias - Adds flint custom alias file to user space.\n## - finagrade.sh lentry - fix gnome nautilus to use always-use-location-entry. \n## - finagrade.sh bupdate - update packages and backup package file. \n## - finagrade.sh setalias - Sets up a git based development environment \n## - finagrade.sh bu2usb - Backup to USB\n## - finagrade.sh bufrusb - Backup from USB\n## - finagrade.sh <date> <ext> - does something cool\n## Where <date> = yyy/mm/dd \n## - finagrade.sh gupdate - updates your git repository. \n## - finagrade.sh bookmarks - Points bookmarks & fix keys for nautilus. \n## - finagrade.sh dsply <file[doc,txt,pdf]> displays these three types\n## in all of these, Output is delivered to the screen...\n## *** NOTE *** These commands need not be run as root, but installing sane code!\n##\n## For structure information type "grep '^\s#\s*' finagrade.sh"\n#\n} # Test: finagrade.sh help \n#\n#\nfunction dummy(){\n#* function dummy - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: finagrade.sh dummy\n#\n#\nfunction bookmarks(){\n#* function bookmarks - install bookmarks and relink for nautilus\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# uroot\n# install bookmarks and relink for nautilus\n# scp flint@trantor.local:./.gtk-bookmarks ~/.\s\nmkdir -p /home/flint/.config/gtk-3.0/obe\nmv /home/flint/.config/gtk-3.0/bookmarks /home/flint/.config/gtk-3.0/obe/$(date +%F)_bookmarks\nln -s /home/flint/.gtk-bookmarks /home/flint/.config/gtk-3.0/bookmarks\nls -alt /home/flint/.config/gtk-3.0/bookmarks\nspause\n} # Test: finagrade.sh dummy\n#\n#\nfunction fxtpi(){\n#* function fxtpi - Fix touch pad indicator\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n#\n# fix touchpad\n# tpi.sh\n# install touchpad control\nsudo add-apt-repository ppa:atareao/atareao\nsudo apt-get update\nsudo apt-get install touchpad-indicator\n#\n} # Test: finagrade.sh fxtpi\n#\nfunction lentry(){\n#* function lentry - fix always use location entry\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\necho "now the gnome config stuff"\nspause\napt-get install dconf-editor\ngsettings get org.gnome.nautilus.preferences always-use-location-entry\necho "now to do it..."\nspause\nsudo dbus-launch gsettings set org.gnome.nautilus.preferences always-use-location-entry "true"\ngsettings get org.gnome.nautilus.preferences always-use-location-entry\nspause\n} # Test: finagrade.sh lentry\n#\nfunction adalias(){\n#* function adalias - Adds the aliases you want in your .bash_aliases\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\necho "Entry"\n# uroot\nwget http://docbox.flint.com/~flint/bin/.bash_aliases\nwget http://docbox.flint.com/~flint/bin/bash_aliases.sh\nchmod +x bash_aliases.sh\necho "remember! Type the following:"\necho ". ./bash_aliases.sh"\necho "That's all folks!"\n} # Test: finagrade.sh dummy\n#\n#\nfunction bupdate(){\n#* function bupdate - Updates package lists & backups packages\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n# update packages\necho "Now you need root"\nsudo apt-get update\n#\n# now update package file\necho "writing packages_$(date +%F)"\ndpkg --get-selections > packages_$(date +%F)\n#\nclear\necho "To restore packages try this:"\necho " ls -alt | grep packages"\necho " dpkg --set-selections < packages"\necho " apt-get dselect-upgrade"\n#\n} # Test: finagrade.sh bupdate\n#\n#\nfunction setalias(){\n#* function setalias - sets the alias features we like\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n# set alias\n#\ncd ~\nmkdir -p ~/obe\ncp .bash_aliases obe/$(date +%F)_.bash_aliases\nwget http://docbox.flint.com/~flint/bin/.bash_aliases\n} # Test: finagrade.sh setalias\n#\nfunction bufrusb(){\n#* function budfrusb - backs up home directory to usb\nclear\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n#\n# mkchoice.sh - make a choice from a list of items\n# Usage: mkchoice.sh [item1] [item2] [item3] ...\n# Example: mkchoice.sh "item 1" "item 2" "item 3"\n# clear files for use\nrm -rf /tmp/choices \nrm -rf /tmp/mounted\nrm -rf /tmp/usbs\nrm -rf /tmp/usbs.txt\nrm -rf /tmp/sources.txt\nrm -rf /tmp/target.txt\nrm -rf /tmp/target.txt\nrm -rf /tmp/doit\n#\n# echo "cleaned up"; read\n# \n# create a list of usb mounted devices \ndf -h |grep media | sort -n |while read line \ndo \n ln=$(($ln+1))\n echo -n $ln " "\n #echo $line \n # echo $(cut -d " " -f 1 $line) \n echo -n -e ' \st ' $(echo -n $line | cut -d " " -f 1) |tee -a /tmp/usbs\n echo -n -e ' \st '|tee -a /tmp/usbs\n echo -n " "$(echo -n $line | cut -d " " -f 2) \n echo -n " "$(echo -n $line | cut -d " " -f 3 |tr -d [:blank:])\n echo -n " " $(echo -n $line | cut -d " " -f 4 |tr -d [:blank:])\n echo -n " " $(echo -n $line | cut -d " " -f 5 |tr -d [:blank:])\n echo -n " " $(echo -n $line | cut -d " " -f 6 |tr -d [:blank:])|tee -a /tmp/usbs\n echo ""|tee -a /tmp/usbs\n#\ndone\n\n# sort -n /tmp/usbs > /tmp/usbs.txt\n#D\n#D echo "start cat /tmp/usbs.txt"\n#D read\n#D cat /tmp/usbs.txt\ncat /tmp/usbs |cut -f 3 > /tmp/choices\necho "Which one do you want to back up? (#)"\n#D read\n# mapfile -t choices < /tmp/choices \nmapfile -t choices < /tmp/choices \n#D cat $choices\n#D read\n# make choice in mapfile\nselect choice in "${choices[@]}" \ndo\n # echo "$choice"\n break\ndone\n#D read\nrm -rf /tmp/choice 2> /dev/null\ngrep $choice /tmp/usbs |cut -f 2 |tee /tmp/choice\n#D > /dev/null\n #\nrm -rf /tmp/mounted 2> /dev/null\ngrep $choice /tmp/usbs |cut -f 3 |tee /tmp/mounted\n#D > /dev/null\n #\n#D echo "start cats"\n#D read\n#\n#D echo "start cat /tmp/mounted"\n#D cat /tmp/mounted\n#D echo "start cat /tmp/choices"\n#D cat /tmp/choices\n#D echo ""\n#\ncat /tmp/usbs | while read line; do grep $choice |tee /tmp/target; done > /dev/null\n# choice="/dev/sdb1";\necho "choice is: "$choice\nutarget=$(cat /tmp/usbs |grep $choice |cut -f 2) ; echo "TADA"$utarget #TADA\n#\necho "Backup Source : " $utarget \n#D $(cat /tmp/mounted |grep $choice)\nbdest=$(echo $choice|cut -d "/" -f 4)\necho "backup destination: "$bdest \n# write command\necho -n 'sudo dd if=' >> /tmp/doit\necho -n $utarget >> /tmp/doit\n# backup from usb drive to <file>$(date +%F).iso\necho -n ' | pv -s 2G | dd of=' >> /tmp/doit\necho -n $(date +%F) >> /tmp/doit\necho -n '_' >> /tmp/doit\necho -n $bdest >> /tmp/doit\necho ' bs=4096' >> /tmp/doit\necho "actual command line is: "\nchmod +x /tmp/doit\ncat /tmp/doit\n# navigate to usb drive\n# run this:rsync -avr /home .\n} # Test: bufrusb.sh dummy\n#\n#\nfunction bu2usb(){\n#* function bu2usb - backs up home directory to usb\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: finagrade.sh dummy\n#\n# backup home to usb drive\n# navigate to usb drive\n# run this:rsync -avr /home .\n#\n#\n# symlink pluma to gedit\n# cd /usr/bin\n# mv gedit gedit.org\n# ln -s pluma gedit\n#\n# install bookmarks and relink for nautilus\n# scp flint@trantor.local:./.gtk-bookmarks ~/.\s\n# mkdir -p /home/flint/.config/gtk-3.0/obe\n# mv /home/flint/.config/gtk-3.0/bookmarks /home/flint/.config/gtk-3.0/obe/$(date +%F)_bookmarks\n# ln -s /home/flint/.gtk-bookmarks /home/flint/.config/gtk-3.0/bookmarks\n# ls -alt /home/flint/.config/gtk-3.0/bookmarks\n# ln -s /home/flint/.gtk-bookmarks /home/flint/.config/gtk-3.0/bookmarks\n# scp flint@trantor.local:./.gtk-bookmarks /home/flint/.\n# mkdir -p /home/flint/.config/gtk-3.0/obe\n# mv bookmarks obe/$(date +%F)_bookmarks\n#\n#\nfunction ibonjour(){\n#* function ibonjour - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n#\ninstall bonjour\napt-get install avahi-daemon avahi-utils avahi-discover\nservice avahi-daemon restart\n#\n} # Test: finagrade.sh ibonjour\n# Fix Tablet\n# https://www.linuxquestions.org/questions/linux-newbie-8/touch-screen-activation-in-ubuntu-15-10-lts-on-panasonic-toughbook-cf-29-mark-v-4175560322/\n#\n# https://www.bobjohnson.com/blog/giving-an-old-toughbook-a-new-lease-on-life-with-linux/\n#\n#https://www.youtube.com/watch?v=pIvWTH8L0Fk\n#\n#\n#https://www.ebay.com/sch/i.html?_from=R40&_trksid=pmkdir -p /home/flint/.config/gtk-3.0/obe2334524.m570.l1313&_nkw=home+elevator+lift&_sacat=0&LH_TitleDesc=0&_osacat=0&_odkw=home+elevator+kit\n#\n#\n#https://www.youtube.com/watch?v=CgdsamzPN8w\n#\n#https://search.yahoo.com/yhs/search?hspart=ddc&hsimp=yhs-linuxmint&type=__alt__ddc_linuxmint_com&p=unistrut+elevator\n#\n#\n#####################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2; \n spause\n exit\nelse\n echo "This script needs to run as root but that's OK as you are root" 1>&2\nfi\n} # Test:~flint/bin/mtoc.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\nfunction sane(){\n#* function sane - check location of vital files and programs, sanity check\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nrm -rf need > /dev/null\nfor prog in openssh-server gparted nautilus pluma git snmp gedit "less" "wget" \n#d ;do echo $prog; done\n#D banana # programs you need put here\ndo\n # echo $prog\n # Better SOURCE:https://www.cyberciti.biz/faq/find-out-if-package-is-installed-in-linux/\n answer=$(echo $(dpkg-query -W -f='${Status} ${Version}\sn' $prog)| cut -d " " -f 3)\n # echo $answer \n if [ "$answer" != "installed" ];\n then\n echo $prog >> need\n #debug echo "Type \s"sudo apt-get install $prog\s" to fix this."\n #debug spause\n # exit 0\n fi\ndone\n#D clear\necho "Welcome to $0!"\n# uroot\necho "Missing programs:"\n if [ -f need ];\n then\n echo " This program needs the following program(s) to be installed on this system."\n cat need |while read line; do echo -e \s\st" - " $line; done\n if [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2\n echo "You want them installed if you are root they will install"\n echo "Leaving this function without installing anything"\n exit\n fi\n spause\n cat need |while read line; do \n echo "apt-get --yes install $line"\n apt-get --yes install $line \n done\n #D \n rm -rf need\n exit 0 # breaks you out of loop...\n else\n echo " * None * Looks like the pot's right, lets play!"\n fi\n#\necho "end of check"\n} # Test: finagrade.sh sane\n#\nfunction flink(){\n#* function flink - Adds adds two symlinks to public\n# This function, which runs as root, will make the program, \n# which must end in sh executable and then\n# then the function adds two symlinks to the first element\n# of the $PATH variable linking the argument and the argument suffixed with "sh"\n# both linked to the second script element (hopefully /usr/local/bin).\n# echo "into root"\n# sudo bash\n# echo "outa root"\nuroot\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# Note user must be "$USER", fix in 2.0\n# trap "set +x; sleep 5; set -x" DEBUG\nHMDIR=$(pwd) # \necho $HMDIR\necho $var2\nspause\nFNAME=$var2\necho "Is this the right name "$FNAME\n#D \nspause\n# echo $PWD | cut -d ":" -f 3\nLKDIR="/usr/local/sbin"\necho $LKDIR\nspause\n# echo "removing "$HMDIR"/fu.sh"; rm $HMDIR/fu.sh 2>/dev/null\ncd $HMDIR/bin\necho $PWD" should be the home bin"\necho $PATH" should be the overall path for "$USER\n#D ls -alt $HMDIRs\ncd $LKDIR\nsudo ln -s $HMDIR/$FNAME .\n# sudo ls -alt $LKDIR/$FNAME\ncd ~\necho -n "keep in mind you are in your home directory now..."\n# \nspause\n} # Test: finagrade.sh flink <filename>\n#\n#\nfunction flunk(){\n#* function flunk - Un-Symlinks [file] & [file].sh into $PATH\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\necho $var2\nspause\nFNAME=$var2\necho "Is this the right name "$FNAME\n#D \nspause\necho "rm /usr/local/sbin/$FNAME -Do This?"\nspause\nsudo rm /usr/local/sbin/$FNAME\n} # Test: finagrade.sh <filename>\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n#d ARGS=$# # carries the number of args into the functions...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause \nif [ "$#" -eq "1" ] && [ "$1" = "adalias" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "lentry" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "fxtpi" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "ibonjour" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "update" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "flink" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "flunk" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "bupdate" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "bu2usb" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "bufrusb" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "setalias" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "bookmarks" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "sane" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause \n#\n#* Dispatcher Routing\n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; $1="help"; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") flint_short_vita_2017-07-01.odtdefvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. TEST: ?fill in test?\n#\n# echo " "; echo "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug echo "That's all folks!!"\n#\n#* restore environment cd "$S"\n}}}
Type the text for '24 February 2023'\n\n{{{\n#!/bin/bash\nversion="0.05"\n#\n# pflint\necho "hello"\necho $version\n#\necho >/dev/null << skip\n# All this stuff is gone \n# this includes anything...\n#\ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\nunless and until you hit\nskip\necho "see?"\n}}}\n\nhttps://ioflood.com/blog/bash-multiline-comment/
Type the text for '24 February 2023'\n\n{{{\n#!/bin/bash\n#\nversion="0.0035"\n#\nvar2=$1\n#\n#\nfunction dummy(){\n#* function dummy - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# uroot\n} # Test: tsg.sh dummy\n#\n\n# gh repo list\n# git clone https://github.com/flintiii/bin.git\n# check argument\n# chkarg\n#\nfunction flig(){\n#* function flig - Resets your directory to head of the line. \necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\necho "argument = "$var2\necho $var2\nexit\nrm -rf /tmp/$var2\nspause\ncd ~\nmv $HOME/$var2 /tmp\nspause\nrm -rf $var2\ngit clone https://github.com/flintiii/bin.git ~/$var2\nspause\ncp /tmp/$var2/* ~/$var2/.\nrm -rf tmp/$var2\necho "All done"\n#\n} # Test: flig.sh <directory>\n#\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n##* function chkarg - checks argument for path...\n\n\nfunction chkarg(){\n#* function chkarg - checks argument for path...\nSTR='/'\necho $STR\nif [[ "$STR" == *"$var2"* ]]; then\n echo "It's there."\nfi\n\n#\necho "path must be off user root"\necho "running flig on "$1 \n\n\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: finagrade.sh chkarg\n\ndummy\nspause \ngrep '^\s#\s*' $0\n}}}
'13 March 2023'\n\n{{{\n#!/bin/bash\nversion="0.027"\n#\n# Sun 05 Mar 2023 03:32:50 PM EST pflint \n# Iteractively installs enki\n# This can take about half hour...\n# SOURCE:https://github.com/andreikop/enki\n# \nfunction help(){\n#* function help - Help function for template basic help goes here\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version\n#\ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is ienki.sh, an extention of unix find.\n## Theis is released under GPL I\n## The syntax is:\n## - ienki.sh sane - Checks that you have the stuff you need. \n## - doroot - installation elements that require root\n## - ienki.sh install - Adds flint custom alias file to user space.\n## - ienki.sh flink - Patches to current user path. \n## - ienki.sh flunk - Removes from current user path. \n## - ienki.sh rdome - maked flint user/directory and populate github\n## - ienki.sh gitstuff - install git based elements \n## - ienki.sh getgh - install gh github cli\n## - ienki.sh getgh1 - install gh github cli\n## - ienki.sh security - gets your security stuff working \n## - ienki.sh pfinst - user level installs \n## in all of these, Output is delivered to the screen...\n## *** NOTE *** These commands need not be run as root, but installing sane code!\n##\n## For structure information type "grep '^\s#\s*' ienki.sh"\n#\n} # Test: ienki.sh help \n#\n\n#\nfunction dummy(){\n#* function dummy - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: ienki.sh dummy\n#\n#\nfunction doroot(){\n#* function doroot - installation elements that require root\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\napt-get update && \s\napt-get --yes install git && \s\napt-get --yes install gh && \s\napt-get install --yes python3 \s\npython3-pyqt5 \s\npython3-pyqt5.qtwebengine \s\npython3-pip\n#\napt-get install python-pip\napt-get install iputils-ping\n#\n# apt-get update;\n# apt-get install -y python3 \s\n# python3-pyqt5 \s\n# python3-pyqt5.qtwebengine\s /usr/local/lib/python3.10/dist-packages/\n# python3-pip\n#\n} # Test: ienki.sh doroot\n#\nfunction rdome(){\n#* function rdome - maked flint user/directory and populate github\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\nsudo useradd flint\nmkdir -p /home/flint\ncd /home/flint\n} # Test: ienki.sh dome\n#\n#\nfunction gitstuff(){\n#* function gitstuff - install git based elements\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# uroot\ngit clone git@github.com:flintiii/bin.git\ngit clone git@github.com:andreikop/qutepart.git\ngit clone git@github.com:andreikop/enki.git\ngit clone git@github.com:flintiii/bin.git\n} # Test: ienki.sh gitstuff\n#\n#\nfunction chkeinki(){\n#* function chkeinki - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n apt-get install python3 libqt5svg5 python3-pyqt5 python3-pyqt5.qtwebengine python3-markdown python3-docutils ctags\n pip3 install -r requirements.txt\n} # Test: finagrade.sh chkeinki\n#\n#\nfunction getgh(){\n#* function getgh - install gh github cli\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# uroot\n# SOURCE:https://github.com/cli/cli/blob/trunk/docs/install_linux.mdcc1\ntype -p curl >/dev/null || sudo apt install curl -y\ncurl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \s\n&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \s\n&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \s\n&& sudo apt update \s\n&& sudo apt install gh -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y\n#\n} # Test: ienki.sh getgh\n#\n#\nfunction shouldgo(){\n#* function shouldgo - the final steps. Enki should go...\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# uroot\npython3 setup.py install\npython3 -m enki\n} # Test: ienki.sh shouldgo\n#\nfunction getgh1(){\n#* function function getgh1 - install gh github cli\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n<type -p curl >/dev/null || sudo apt install curl -y\ncurl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \s\n&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \s\n&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \s\n&& sudo apt update \s\n&& sudo apt install gh -y\n} # Test: ienki.sh getgh1\n#\n#\nfunction security(){\n#* function security - gets your security stuff working...\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\nscp flint@192.168.1.242:~flint/.ssh/id_rsa* ~flint/.ssh/. \ngh auth login --hostname flintiii --with-token "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"\n\ngh auth login --hostname flintiii\n} # Test: ienki.sh security\n#\nfunction pfinst(){\n#* function pfinst - user level installs\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# uroot\n# pflint\n# \n# pip install Python-Markdown /# For Markdown preview\n# pip install Docutils /# For reStructuredText preview\n# pip install ctags /# For navigation in file\n# pip install regex /# For preview synchronization\n# pip install CodeChat /# For source code to HTML translation (literate programming)\n# pip install Sphinx /# To build Sphinx documentation.\n# pip install Flake8 /# To lint your Python code.\n#\n} # Test: ienki.sh pfinst\n#\n#*####################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2; \n spause\n exit\nelse\n echo "This script needs to run as root but that's OK as you are root" 1>&2\nfi\n} # Test:~flint/bin/mtoc.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\nfunction sane(){\n#* function sane - check location of vital files and programs, sanity check\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nrm -rf need > /dev/null\nfor prog in openssh-server gparted nautilus pluma git snmp gedit "less" "wget" \n#d ;do echo $prog; done\n#D banana # programs you need put here\ndo\n # echo $prog\n # Better SOURCE:https://www.cyberciti.biz/faq/find-out-if-package-is-installed-in-linux/\n answer=$(echo $(dpkg-query -W -f='${Status} ${Version}\sn' $prog)| cut -d " " -f 3)\n # echo $answer \n if [ "$answer" != "installed" ];\n then\n echo $prog >> need\n #debug echo "Type \s"sudo apt-get install $prog\s" to fix this."\n #debug spause\n # exit 0\n fi\ndone\n#D clear\necho "Welcome to $0!"\n# uroot\necho "Missing programs:"\n if [ -f need ];\n then\n echo " This program needs the following program(s) to be installed on this system."\n cat need |while read line; do echo -e \s\st" - " $line; done\n if [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2\n echo "You want them installed if you are root they will install"\n echo "Leaving this function without installing anything"\n exit\n fi\n spause\n cat need |while read line; do \n echo "apt-get --yes install $line"\n apt-get --yes install $line \n done\n #D \n rm -rf need\n exit 0 # breaks you out of loop...\n else\n echo " * None * Looks like the pot's right, lets play!"\n fi\n#\necho "end of check"\n} # Test: finagrade.sh sane\n#\nfunction flink(){\n#* function flink - Adds adds two symlinks to public\n# This function, which runs as root, will make the program, \n# which must end in sh executable and then\n# then the function adds two symlinks to the first element\n# of the $PATH variable linking the argument and the argument suffixed with "sh"\n# both linked to the second script element (hopefully /usr/local/bin).\n# echo "into root"\n# sudo bash\n# echo "outa root"\nuroot\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# Note user must be "$USER", fix in 2.0\n# trap "set +x; sleep 5; set -x" DEBUG\nHMDIR=$(pwd) # \necho $HMDIR\necho $var2\nspause\nFNAME=$var2\necho "Is this the right name "$FNAME\n#D \nspause\n# echo $PWD | cut -d ":" -f 3\nLKDIR="/usr/local/sbin"\necho $LKDIR\nspause\n# echo "removing "$HMDIR"/fu.sh"; rm $HMDIR/fu.sh 2>/dev/null\ncd $HMDIR/bin\necho $PWD" should be the home bin"\necho $PATH" should be the overall path for "$USER\n#D ls -alt $HMDIRs\ncd $LKDIR\nsudo ln -s $HMDIR/$FNAME .\n# sudo ls -alt $LKDIR/$FNAME\ncd ~\necho -n "keep in mind you are in your home directory now..."\n# \nspause\n} # Test: finagrade.sh flink <filename>\n#\n#\nfunction flunk(){\n#* function flunk - Un-Symlinks [file] & [file].sh into $PATH\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\necho $var2\nspause\nFNAME=$var2\necho "Is this the right name "$FNAME\n#D \nspause\necho "rm /usr/local/sbin/$FNAME -Do This?"\nspause\nsudo rm /usr/local/sbin/$FNAME\n} # Test: finagrade.sh <filename>\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n#d ARGS=$# # carries the number of args into the functions...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause \nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "doroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "rdome" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "gitstuff" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "getgh" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "shouldgo" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "getgh1" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "security" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "sane" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause \n#\n#* Dispatcher Routing\n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; $1="help"; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") flint_short_vita_2017-07-01.odtdefvbl; $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. TEST: ?fill in test?\n#\n# echo " "; echo "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug echo "That's all folks!!"\n# # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n "9") var3=grep '^\s#\s*' tsg.sh$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. TEST: ?fill in test?\n#\n# echo " "; echo "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug echo "That's all folks!!"\n#\n# echo "road closed at line $LINENO"\n# 2>/dev/null << cut\n#\n# cut\n# echo "Hello from line $LINENO!"\n\n\n}}}\n
Type the text for '1 January 2024'\n\nIf you get this error on ssh login:\nUnable to negotiate with 45.33.2.189 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss\n\n\nuse the following:\n\nssh1\n{{{\n\n#!/bin/bash\n/usr/bin/ssh -oHostKeyAlgorithms=+ssh-rsa,ssh-dss $1\n\n}}}\n
Type the text for '10 January 2024'\n\nThe deal here is to apply termux, visualbash and docker containers to solve the universal variable problem in bash, and additionally in visual bash.\n\nThe way of this therefore is [[docker|http://docbox.flint.com:8081/docker]]
Type the text for '05 February 2024'\n\nmopvoh.sh\n{{{\n#! /usr/bin/bash\n# Tue 16 Jan 2024 01:45:52 PM EST \nname="My Own Personal Version Of Hell"\npname="mopvoh.sh"\nversion="0.2024.02.05.13:26\n"\n#\n# Installs docker as part of sane.\n#\n#\nfunction help(){\n#* function help - Help function for template basic help goes here\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; uroot #deb\n#\ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is mopvoh.sh. This is released under GPL I\n## The syntax is functionally divided:\n## System\n## - sane - Checks that you have the stuff you need.\n## - adalias - Adds flint custom alias file to user space.\n## - flink/flunk- Patches or removes argumment to current user path.\n## - bupdate - update packages and backup package file.\n## Linux Containers (LXC)\n## - lxc-create <NAME> creates a dicker instance.\n## - lxc-update - updates your git repository.\n## Python\n## - inspy24 - installs python 2.4 on current system.\n## Zope\n## - inszp21 - installs 2.10 version of python on current system.\n## Data\n## - dupdate - update Data.fs locally\n## - tpiclle - tests Data.fs locally\n## *** NOTE *** Most commands need to be run as root.\n## For structure information type "grep '^\s#\s*' mopvoh.sh"\n} # Test: mopvoh.sh help\n#\n#\nfunction dummy(){\n#* function dummy - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: mopvoh.sh dummy\n#\n#\nfunction lxc-create(){\n#* function lxc-create - creates a dicker instance with NAME\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: mopvoh.sh lxc-create\n#\n\n#\nfunction lxc-update(){\n#* function lxc-update - updates your git repository.\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: mopvoh.sh lxc-update\n#\nfunction inszp21(){\n#* function inszp21 - installs zope on current system.\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: mopvoh.sh inszp21\n#\nfunction inspy24(){\n#* function inspy24 - installs python 2.4 on current system.\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: mopvoh.sh inspy24\n#\nfunction dupdate(){\n#* function dupdate - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: mopvoh.sh dupdate\n#\nfunction tpiclle(){\n#* function tpiclle - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test: mopvoh.sh tpiclle\n#\nfunction toftpad(){\n#* function toftpad - Turn off touchpad\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n# xinput | grep -i touch\necho " "\necho "Turn off this Touchpad?"\nxinput | grep -i touchpad |tr -s " " |cut -d " " -f 3-\ndsabl=$(xinput | grep -i touchpad |tr -s " " |cut -d " " -f 6 |tr -d " \st"|cut -d "=" -f2 |cut -d "[" -f 1)\npntr=$(xinput | grep -i touchpad |tr -s " " |strings |cut -d " " -f2) \necho "This is hooked to the touchpad pointer: "$pntr\nxinput | grep -i $pntr\necho "Be prepared to disable \s"id\s"s related to pointer..."\necho "xinput disable "$dsabl\necho "Cntrl<C> to stop"\nspause \n# xinput disable \n} # Test: mopvoh.sh toftpad\n#\nfunction bookmarks(){\n#* function bookmarks - install bookmarks and relink for nautilus\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# uroot\n# install bookmarks and relink for nautilus\n# scp flint@trantor.local:./.gtk-bookmarks ~/.\s\nmkdir -p /home/flint/.config/gtk-3.0/obe\necho $USER\nmv /home/flint/.config/gtk-3.0/bookmarks /home/flint/.config/gtk-3.0/obe/$(date +%F)_bookmarks\nln -s /home/flint/.gtk-bookmarks /home/flint/.config/gtk-3.0/bookmarks\nls -alt /home/flint/.config/gtk-3.0/bookmarks\nspause\n} # Test: mopvoh.sh bookmarks\n#\n#\nfunction fxtpi(){\n#* function fxtpi - Fix touch pad indicator\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n#\n# fix touchpad\n# tpi.shlentry\n# install touchpad control\nsudo add-apt-repository ppa:atareao/atareao\nsudo apt-get update\nsudo apt-get install touchpad-indicator\n#\n} # Test: mopvoh.sh fxtpi\n#\nfunction lentry(){\nF#* function lentry - fix always use location entry\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\necho "now the gnome config stuff"\nspause\napt-get install dconf-editor\ngsettings get org.gnome.nautilus.preferences always-use-location-entry\necho "now to do it..."\nspause\nsudo dbus-launch gsettings set org.gnome.nautilus.preferences always-use-location-entry "true"\ngsettings get org.gnome.nautilus.preferences always-use-location-entry\nspause\n} # Test: mopvoh.sh lentry\n#\nfunction adalias(){\n#* function adalias - Adds the aliases you want in your .bash_aliases\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\necho "Entry"\n# uroot\nwget http://docbox.flint.com/~flint/bin/.bash_aliases\nwget http://docbox.flint.com/~flint/bin/bash_aliases.sh\nchmod +x bash_aliases.sh\necho "remember! Type the following:"\necho ". ./bash_aliases.sh"\necho "That's all folks!"\n} # Test: mopvoh.sh adalias\n#\n#\nfunction bupdate(){\n#* function bupdate - Updates package lists & backups packages\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n# update packages\necho "Now you need root"\nsudo apt-get update\n#\n# now update package file\necho "writing packages_$(date +%F)"\ndpkg --get-selections > packages_$(date +%F)\n#\nclear\necho "To restore packages try this:"\necho " ls -alt | grep packages"\necho " dpkg --set-selections < packages"\necho " apt-get dselect-upgrade"\n#\n} # Test: mopvoh.sh bupdate\n#\n#\nfunction setalias(){\n#* function setalias - sets the alias features we like\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n# set alias\n#\ncd ~\nmkdir -p ~/obe\ncp .bash_aliases obe/$(date +%F)_.bash_aliases\nwget http://docbox.flint.com/~flint/bin/.bash_aliases\n} # Test: mopvoh.sh setalias\n#\nfunction bufrusb(){\n#* function budfrusb - backs up home dSirectory to usb\nclear\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n#\n# mkchoice.sh - make a choice from a list of items\n# Usage: mkchoice.sh [item1] [item2] [item3] ...\n# Example: mkchoice.sh "item 1" "item 2" "item 3"\n# clear files for use\nrm -rf /tmp/choices\nrm -rf /tmp/mounted\nrm -rf /tmp/usbs\nrm -rf /tmp/usbs.txt\nrm -rf /tmp/sources.txt\nrm -rf /tmp/target.txt\nrm -rf /tmp/target.txt\nrm -rf /tmp/doit\n#\n# echo "cleaned up"; read\n#\n# create a list of usb mounted devices\ndf -h |grep media | sort -n |while read line\ndo\n ln=$(($ln+1))\n echo -n $ln " "\n #echo $line\n # echo $(cut -d " " -f 1 $line)\n echo -n -e ' \st ' $(echo -n $line | cut -d " " -f 1) |tee -a /tmp/usbs\n echo -n -e ' \st '|tee -a /tmp/usbs\n echo -n " "$(echo -n $line | cut -d " " -f 2)\n echo -n " "$(echo -n $line | cut -d " " -f 3 |tr -d [:blank:])\n echo -n " " $(echo -n $line | cut -d " " -f 4 |tr -d [:blank:])\n echo -n " " $(echo -n $line | cut -d " " -f 5 |tr -d [:blank:])\n echo -n " " $(echo -n $line | cut -d " " -f 6 |tr -d [:blank:])|tee -a /tmp/usbs\n echo ""|tee -a /tmp/usbs\n#\ndone\n\n# sort -n /tmp/usbs > /tmp/usbs.txt\n#D\n#D echo "start cat /tmp/usbs.txt"\n#D read\n#D cat /tmp/usbs.txt\ncat /tmp/usbs |cut -f 3 > /tmp/choices\necho "Which one do you want to back up? (#)"\n#D read\n# mapfile -t choices < /tmp/choices\nmapfile -t choices < /tmp/choices\n#D cat $choices\n#D read\n# make choice in mapfile\nselect choice in "${choices[@]}"\ndo\n # echo "$choice"\n break\ndone\n#D read\nrm -rf /tmp/choice 2> /dev/null\ngrep $choice /tmp/usbs |cut -f 2 |tee /tmp/choice\n#D > /dev/null\n #\nrm -rf /tmp/mounted 2> /dev/null\ngrep $choice /tmp/usbs |cut -f 3 |tee /tmp/mounted\n#D > /dev/null\n #D echo "start cats"\n#D read\n#\n#D echo "start cat /tmp/mounted"\n#D cat /tmp/mounted\n#D echo "start cat /tmp/choices"\n#D cat /tmp/choices\n#D echo ""\n#\ncat /tmp/usbs | while read line; do grep $choice |tee /tmp/target; done > /dev/null\n# choice="/dev/sdb1";\necho "choice is: "$choice\nutarget=$(cat /tmp/usbs |grep $choice |cut -f 2) ; echo "TADA"$utarget #TADA\n#\necho "Backup Source : " $utarget\n#D $(cat /tmp/mounted |grep $choice)\nbdest=$(echo $choice|cut -d "/" -f 4)\necho "backup destination: "$bdest\n# write command\necho -n 'sudo dd if=' >> /tmp/doit\necho -n $utarget >> /tmp/doit\n# backup from usb drive to <file>$(date +%F).iso\necho -n ' | pv -s 2G | dd of=' >> /tmp/doit\necho -n $(date +%F) >> /tmp/doit\necho -n '_' >> /tmp/doit\necho -n $bdest >> /tmp/doit\necho ' bs=4096' >> /tmp/doit\necho "actual command line is: "\nchmod +x /tmp/doit\ncat /tmp/doit\n# navigate to usb drive\n# run this:rsync -avr /home .\n} # Test: bufrusb.sh doit\n#\n#\nfunction bu2usb(){\n#* function bu2usb - backs up home directory to usb\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test:pluma mopvoh.sh dummy\n#\n# backup home to usb drive\n# navigate to usb drive\n# run this:rsync -avr /home .\n#\n#\n# symlink pluma to gedit\n# cd /usr/bin\n# mv gedit gedit.org\n# ln -s pluma gedit\n#\nfunction pluma(){\n#* function pluma - make pluma default gui editor\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\necho "which files:"\nwhich gedit\nwhich pluma\n # symlink pluma to gedit\n cd /usr/bin\n mv gedit gedit.org\n ln -s pluma gedit\n\n} # Test: mopvoh.sh pluma\n#\n\n\n\n#\n# install bookmarks and relink for nautilus\n# scp flint@trantor.local:./.gtk-bookmarks ~/.\s\n# mkdir -p /home/flint/.config/gtk-3.0/obe\n# mv /home/flint/.config/gtk-3.0/bookmarks /home/flint/.config/gtk-3.0/obe/$(date +%F)_bookmarks\n# ln -s /home/flint/.gtk-bookmarks /home/flint/.config/gtk-3.0/bookmarks\n# ls -alt /home/flint/.config/gtk-3.0/bookmarks\n# ln -s /home/flint/.gtk-bookmarks /home/flint/.config/gtk-3.0/bookmarks\n# scp flint@trantor.local:./.gtk-bookmarks /home/flint/.\n# mkdir -p /home/flint/.config/gtk-3.0/obe\n# mv bookmarks obe/$(date +%F)_bookmarks\n#\n#\nfunction ibonjour(){\n#* function ibonjour - Rename and fill stuff in between braces\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n#\ninstall bonjour\napt-get install avahi-daemon avahi-utils avahi-discover\nservice avahi-daemon restart\n#\n} # Test: mopvoh.sh ibonjour\n# Fix Tablet\n# https://www.linuxquestions.org/questions/linux-newbie-8/touch-screen-activation-in-ubuntu-15-10-lts-on-panasonic-toughbook-cf-29-mark-v-4175560322/\n#\n# https://www.bobjohnson.com/blog/giving-an-old-toughbook-a-new-lease-on-life-with-linux/\n#\n#https://www.youtube.com/watch?v=pIvWTH8L0Fk\n#\n#\n#https://www.ebay.com/sch/i.html?_from=R40&_trksid=pmkdir -p /home/flint/.config/gtk-3.0/obe2334524.m570.l1313&_nkw=home+elevator+lift&_sacat=0&LH_TitleDesc=0&_osacat=0&_odkw=home+elevator+kit\n#\n#\n#https://www.youtube.com/watch?v=CgdsamzPN8w\n#\n#https://search.yahoo.com/yhs/search?hspart=ddc&hsimp=yhs-linuxmint&type=__alt__ddc_linuxmint_com&p=unistrut+elevator\n#\n#\n#####################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2;\n spause\n exit\nelse\n echo "This script needs to run as root but that's OK as you are root" 1>&2\nfi\n} # Test:~flint/bin/mtoc.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\nfunction sane(){\n#* function sane - check location of vital files and programs, sanity check\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nrm -rf need > /dev/null\nfor prog in openssh-server gparted nautilus pluma git snmp gedit sudo vim most less wget docker.io \n#d ;do echo $prog; done\n#D banana # programs you need put here\ndo\n # echo $prog\n # Better SOURCE:https://www.cyberciti.biz/faq/find-out-if-package-is-installed-in-linux/\n answer=$(echo $(dpkg-query -W -f='${Status} ${Version}\sn' $prog)| cut -d " " -f 3)\n # echo $answer\n if [ "$answer" != "installed" ]\n then\n echo $prog >> need\n #debug echo "Type \s"sudo apt-get install $prog\s" to fix this."\n #debug spause\n # exit 0\n fi\ndone\n#D clear\necho "Welcome to $0!"\n# uroot\necho "Missing programs:"\n if [ -f need ];\n then\n echo " This program needs the following program(s) to be installed on this system."\n cat need |while read line; do echo -e \s\st" - " $line; done\n if [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2\n echo "You want them installed if you are root they will install"\n echo "Leaving this function without installing anything"\n exit\n fi\n spause\n cat need |while read line; do\n echo "apt-get --yes install $line"\n apt-get --yes install $line\n done\n #D\n rm -rf need\n exit 0 # breaks you out of loop...\n else\n echo " * None * Looks like the pot's right, lets play!"\n fi\n#\necho "end of check"\n} # Test: mopvoh.sh sane\n#\nfunction flink(){\n#* function flink - Adds adds two symlinks to public\n# This function, which runs as root, will make the program,\n# which must end in sh executable and then\n# then the function adds two symlinks to the first element\n# of the $PATH variable linking the argument and the argument suffixed with "sh"\n# both linked to the second script element (hopefully /usr/local/bin).\n# echo "into root"\n# sudo bash\n# echo "outa root"\nuroot\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n# Note user must be "$USER", fix in 2.0\n# trap "set +x; sleep 5; set -x" DEBUG\nHMDIR=$(pwd) #\necho $HMDIR\necho $var2\nspause\nFNAME=$var2\necho "Is this the right name "$FNAME\n#D\nspause\n# echo $PWD | cut -d ":" -f 3\nLKDIR="/usr/local/sbin"\necho $LKDIR\nspause\n# echo "removing "$HMDIR"/fu.sh"; rm $HMDIR/fu.sh 2>/dev/null\ncd $HMDIR/bin\necho $PWD" should be the home bin"\necho $PATH" should be the overall path for "$USER\n#D ls -alt $HMDIRs\ncd $LKDIR\nsudo ln -s $HMDIR/$FNAME .\n# sudo ls -alt $LKDIR/$FNAME\ncd ~\necho -n "keep in mind you are in your home directory now..."\n#\nspause\n} # Test: mopvoh.sh flink <filename>\n#\n#\nfunction flunk(){\n#* function flunk - Un-Symlinks [file] & [file].sh into $PATH\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\necho $var2\nspause\nFNAME=$var2\necho "Is this the right name "$FNAME\n#D\nspause\necho "rm /usr/local/sbin/$FNAME -Do This?"\nspause\nsudo rm /usr/local/sbin/$FNAME\n} # Test: mopvoh.sh <filename>\n#\n#*###################################### MAIN ENTRY POINT AND COMPOUND CASE\n#\n#* Evaluator Routine\n# Note the evaluator allows for many cases and error checking...\n#d ARGS=$# # carries the number of args into the functions...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause\nif [ "$#" -eq "1" ] && [ "$1" = "adalias" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "lentry" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "fxtpi" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "ibonjour" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "toftpad" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "update" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "flink" ]; then ARGS="2"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "flunk" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "bupdate" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "bu2usb" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "pluma" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "bufrusb" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "setalias" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "bookmarks" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dummy" ]; then ARGS="1"; fi\nif [ "$#" -eq "2" ] && [ "$1" = "lxc-create" ]; then ARGS="2"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "lxc-update" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "inspy24" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "inszp21" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "dupdate" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "tpiclle" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "uroot" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "spause" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "sane" ]; then ARGS="1"; fi\nif [ "$#" -eq "1" ] && [ "$1" = "help" ]; then ARGS="9"; fi\n# this tests the evaluator...\n#D echo $#" "$1" "$2" "$3" "$ARGS ;spause\n#\n#* Dispatcher Routing\n# typical cases, be careful to make your own...\ncase "$ARGS" in\n "0") clear; $1="help"; exit 1;; # got nothing, display help and go\n "1") $1 ;; # run the command\n "2") var2=$2; $1 ;; # run the command with an argument\n "3") var3=$3; var2=$2; $1 ;; # run the command with two arguments\n "4") var4=$4; var3=$3; var2=$2; $1 ;; # run the command with three arguments\n "5") prompt=$2; $1 ;; # run the command with a different argument\n "6") time=$3; prompt=$2; $1 ;; # run the command with two different arguments\n "7") $1 ;; # run the command and default variables\n "8") var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n "9") var3=$3; var2=$2; $1 ;; # run the command and settle variables\n *) clear; cat $0 | grep '^## '| sed -e 's/##//'; exit 1;; # Anything else run help and exit...\nesac # End main loop. TEST: ?fill in test?\n#\n# echo " "; echo "On "$(date +%F\s %r) $0" version "$version" stops"\n#debug echo "That's all folks!!"\n#\n#* restore environment cd "$S"\n\n}}}
Type the text for '29 January 2024'\n\n\n{{{\n}}}
Type the text for '19 March 2024'\n\na structural target\n{{{\n; fi # \n}}}\n\n{{{\ncat ./lxcycl.sh | grep "; fi # "\n}}}\n\n{{{magen.sh \ncat ./lxcycl.sh | grep "; fi # " | cut -c 70-\n}}}\n\n{{{\ncat ./lxcycl.sh | grep "; fi # " | cut -c 70-\n}}}\n\n{{{\n#!/usr/bin/bash\n#\n#pflint Tue 12 Mar 2024 10:14:24 AM EDT \n#\nversion="2024.03.12.18"\n# Magic FED\nfile="/home/rick/docker/bin/lxcycl.sh"\n#D \necho $file\n#\ncat $file |\nwhile read line; \ndo \n #D echo $line \n # desc=$(echo $line |grep "; fi # " | cut -c 60-) \n #D \n desc=$(echo $line |grep "; fi # " | cut -d "#" -f 3) \n # echo $desc\n # echo $line | grep '" = "' | cut -d '"' -f 8\n name=$(echo $line | grep '" = "' | cut -d '"' -f 8)\n #D \n echo $name , $desc |grep -v ,$\n #D echo " - "\ndone\n# cat $file | grep '" = "' | cut -d '"' -f 8\n}}}\n\n\nThe lesson here is what you need is this process:\n# Build Menu with these elements:\n## Name\n## Number of Variables\n## Description\n# The program "[[magen.sh]]" (magic generator) or menubot.sh writes out the functions &\n# writes the dispatcher.\n\nBasically, magen.sh or menubot.sh is a visual bash generator, input a help table, get back a working framework.\n\n \n\n
Type the text for '19 March 2024'\n\n{{{\nfunction flink(){\n#* function flink - Adds one symbolic link between named program\n# and the profiled directory /home/user/bin\n# uroot\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version \n#Debug\nFNAME=$var2; \n#D echo $FNAME\necho "Have found " $FNAME"!"\nSTDIR=$(pwd) \necho "creating target... "\n#D echo $STDIR\n#D echo $HOME\nTARGET=$HOME"/bin/"$FNAME\necho $TARGET\n# if [ -e "$TARGET" ]; echo "Already Linked"; fi\nif test -f $TARGET ; then echo "Link Exists flunk first!"; return; fi\n#\ncd $STDIR\n# echo $PWD \necho $FNAME" should be in the home path"\n# echo " "$PATH\necho $PATH| tr ":" "\sn" |while read line; do echo " - "$line; done # Very Cool\necho "Above is the be overall path for "$USER\n#D ls -alt $HMDIRs\necho "linking now"\nSOURCE=$PWD"/"$FNAME\n# echo "Source "$SOURCE\n# echo "Target "$TARGET\necho "What happens here is this:"\necho "ln -s " $SOURCE $TARGET \nln -s $SOURCE $TARGET \n# ls -alt $TARGET\necho "Output of the 'Which' command shows "$FNAME" linked to the path "\nwhich $FNAME\n# \n} # Test: lxcycl.sh flink <filename>\n#\n#\nfunction flunk(){\n#* function flunk - Un-Symlinks [file] & [file].sh into $PATH\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#D echo $var2\nFNAME=$var2\necho "Is this the right name to unlink? "$FNAME\n# TARGET=$HOME"/bin/"$FNAME\nTARGET=$(which $FNAME)\necho "Have found a link to "\necho $TARGET \n#\necho "Do This?"\necho "rm "$TARGET\nspause\nrm $TARGET\n} # Test: lxcycl.sh flunk <filename>\n#\n\n}}}
Type the text for '31 March 2024'\n\nThank you for providing the ASCII representation of the PowerPoint presentation on VisualBash. Based on the content provided, it seems that VisualBash is a framework for developing command-line scripts in Bash, focusing on simplicity, flexibility, and ease of use. Here's a summary of the key points:\n\n Introduction:\n VisualBash is introduced as a framework for command-line scripting, drawing inspiration from musical frameworks like the "Blues."\n It emphasizes the enduring structures in life and technology, highlighting the simplicity and effectiveness of certain frameworks.\n\n Technical Introduction:\n The presenter shares their background in writing command-line scripts in various languages, leading to the development of VisualBash.\n The presentation promises rewards for well-thought-out questions.\n\n Historical Context:\n Mentions significant events like the GNU C compiler running on IBM VM and the emergence of Linux on mainframes.\n\n Programming Philosophy:\n Emphasizes programming as more of an art than a science, highlighting the personal creative resonance it can evoke.\n Focuses on the potential of Bash as a programming environment due to its ability to preserve and string together results seamlessly.\n\n Components of VisualBash:\n Functions: Encourages the use of functions extensively, with global variables and testing/returning variables being common practices.\n Evaluator: Determines the number and type of incoming variables to properly dispatch commands.\n Dispatcher: Orders variables for execution by functions, handles defaults, and can handle various numbers of variables.\n\n Interface Choices:\n VisualBash supports multiple interface choices, including character graphics, GUI wrap, Whiptail, web, and Zenity.\n Secure Graphic Dispatch (SGD) is highlighted as a method for graphical delivery of VisualBash commands.\n\n Conclusion and Acknowledgments:\n Acknowledges contributions from various individuals in developing VisualBash.\n Promises continued research and development in the areas covered in the presentation.\n\nOverall, VisualBash appears to be a framework designed to harness the power of Bash scripting in a structured and flexible manner, with considerations for various interface options and ease of use. If you have specific questions or tasks related to VisualBash, feel free to ask!\n\n
Type the text for '31 March 2024'\n\nComment from ChatGPT...\n\nThis appears to be a Bash script named "menubot" designed to generate a crude menu file from either a .sh or .shi file. Here's a breakdown of the script:\n\n Header: Contains metadata like version number and author information.\n\n Main Functions:\n help: Displays help information.\n genpars: Generates Help, Evaluator, and Dispatcher functions.\n pulfun: Extracts functions from a file.\n gentop: Generates the top of the shell script.\n genmen: Generates the entire menu.\n genment, genmenm, genmenb: Generate parts of the menu.\n samuf: Renames and fills stuff between braces.\n gensamuf: Generates standard and potentially useful functions.\n geneval: Generates the Evaluator routine.\n gendisp: Generates the Dispatcher routine.\n uroot: Checks if the script is run as root.\n spause: Provides a simple pause function.\n defvbl: Sets defau/visual.bashlt variables for no arguments.\n dummy: A placeholder function.\n\n Evaluator Routine: Parses arguments and determines the appropriate action.\n\n Dispatcher Routine: Executes commands based on the arguments provided.\n\n Main Entry Point: Evaluates arguments and dispatches accordingly.\n\n Restores Environment: Returns to the original working directory after execution.\n\nOverall, this script seems to be designed to automate the generation of menu files for shell scripts by extracting function names and documentation from source files. It also includes functions for handling arguments, displaying help information, and managing the script environment.
Type the text for '21 April 2024'\n\n[[Bash & Alias|http://mywiki.wooledge.org/BashFAQ/080]]\n[[Bash Subfunctions|https://ss64.com/bash/function.html]]\n\nFrom Command line Example:\n{{{\nlsl() { ls -l $1; }\n}}}\n\n{{{\ngreet() \n{ \necho "Hello, World!" \n}\n}}}\n\n\ntest.sh\n{{{\n#!/bin/bash\n#\n# Sun 21 Apr 2024 06:19:00 PM EDT \n#\ngreet() \n{ \necho "Hello, World!" \n}\n}}}\n\nInvocation\n\n{{{\n. ./test.sh\n}}}
\n@@declare@@ [@@-aAfFgiIlnrtux@@] [@@-p@@] [''name''[''=value''] ...]\n@@typeset@@ [@@-aAfFgiIlnrtux@@] [@@-p@@] [''name''[''=value''] ...]\n\nDeclare variables and/or give them attributes. If no ''name''s are given then display the values of variables. The @@-p@@ option will display the attributes and values of each ''name''. When @@-p@@ is used with ''name'' arguments, additional options, other than @@-f@@ and @@-F@@, are ignored. When @@-p@@ is supplied without ''name'' arguments, it will display the attributes and values of all variables having the attributes specified by the additional options. If no other options are supplied with @@-p@@, @@declare@@ will display the attributes and values of all shell variables. The @@-f@@ option will restrict the display to shell functions. The @@-F@@ option inhibits the display of function definitions; only the function name and attributes are printed. If the @@extdebug@@ shell option is enabled using @@shopt@@, the source file name and line number where each ''name'' is defined are displayed as well. The @@-F@@ option implies @@-f@@. The @@-g@@ option forces variables to be created or modified at the global scope, even when @@declare@@ is executed in a shell function. It is ignored in all other cases. The @@-I@@ option causes local variables to inherit the attributes (except the ''nameref'' attribute) and value of any existing variable with the same ''name'' at a surrounding scope. If there is no existing variable, the local variable is initially unset. The following options can be used to restrict output to variables with the specified attribute or to give variables attributes:\n\n|!OPTION|!DESCRIPTION|\n| @@-a@@ |Each ''name'' is an indexed array variable (see Arrays above).|\n| @@-A@@ |Each ''name'' is an associative array variable (see Arrays above).|\n| @@-f@@ |Use function names only.|\n| @@-i@@ |The variable is treated as an integer; arithmetic evaluation (see ARITHMETIC EVALUATION above) is performed when the variable is assigned a value.|\n| @@-l@@ |When the variable is assigned a value, all upper-case characters are converted to lower-case. The upper-case attribute is disabled.|\n| @@-n@@ |Give each ''name'' the ''nameref'' attribute, making it a name reference to another variable. That other variable is defined by the value of ''name''. All references, assignments, and attribute modifications to ''name'', except those using or changing the -n attribute itself, are performed on the variable referenced by ''name'''s value. The ''nameref'' attribute cannot be applied to array variables.|\n| @@-r@@ |Make ''name''s readonly. These names cannot then be assigned values by subsequent assignment statements or unset.|\n| @@-t@@ |Give each ''name'' the ''trace'' attribute. Traced functions inherit the DEBUG and RETURN traps from the calling shell. The trace attribute has no special meaning for variables.|\n| @@-u@@ |When the variable is assigned a value, all lower-case characters are converted to upper-case. The lower-case attribute is disabled.|\n| @@-x@@ |Mark ''name''s for export to subsequent commands via the environment.|\n\nUsing '@@+@@' instead of '@@-@@' turns off the attribute instead, with the exceptions that @@+a@@ and @@+A@@ may not be used to destroy array variables and @@+r@@ will not remove the readonly attribute. When used in a function, @@declare@@ and @@typeset@@ make each ''name'' local, as with the local command, unless the @@-g@@ option is supplied. If a variable name is followed by =''value'', the value of the variable is set to ''value''. When using @@-a@@ or @@-A@@ and the compound assignment syntax to create array variables, additional attributes do not take effect until subsequent assignments. The return value is 0 unless an invalid option is encountered, an attempt is made to define a function using '@@-f foo=bar@@', an attempt is made to assign a value to a read only variable, an attempt is made to assign a value to an array variable without using the compound assignment syntax (see Arrays above), one of the ''name''s is not a valid shell variable name, an attempt is made to turn off readonly status for a readonly variable, an attempt is made to turn off array status for an array variable, or an attempt is made to display a non-existent function with @@-f@@.\n
Type the text for '19 March 2024'\n\n# reads the .mnu file\n# extracts function\n# creates functions \n# Creates descriptions\n# generates dummy function\n# generates other functions\n# generates case list evaluation\n# generates dispatch\n# inserts menu at top\n\nmenubot.sh\n\n\n{{{\nInsert magic here...\n}}}
Type the text for '2 February 2017'\n\nSample Data\n{{{\nWed 01 May 2024 09:07:02 AM EDT \n\n\n## - flint - Flint Information Technology Site\n## - bosi - The Barre Open Systems Institute BOSI site\n## - family - The flint family site\n## - yarger - Old Yarger site\n}}}\n\n\n[[BNF|https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form]]\n\nparsemnu.sh\n{{{\n#!/bin/bash\n# pflint \nversion=0.0\n# note this format allows for comments..\ncat test.mnu |grep "-" | tr -s " " |while read line; \ndo \nfname=$(echo $line | cut -d "-" -f 2 | tr -d " ") # ; echo $fname\nfdesc=$(echo $line | cut -d "-" -f 3) # ; echo $fdesc\necho 'function '$fname'(){'\necho ' #* function '$fname' - '$fdesc\necho 'echo "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug '\necho 'echo "Insert function here!"'\necho ' }'\necho ''\ndone\n\n}}}\n\nhlpdmy.sh\n{{{\n#!/bin/bash\necho "Start"\ntarget="test.sh"\nif test -f $target; then\necho "killing old "$target\nrm -rf $target\nfi\n# \nString="$(cat <<EOF\n#!/bin/bash\n# pflint \n# cdate\nversion=0.0 \n#\n#* function help - Help function for template basic help goes here\nfunction help(){\nclear;\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version; uroot #debug \ncat $0 | grep '^## ' | sed -e 's/##//'\n# echo "This is the help function"\n## *****DOCUMENTATION*****\n## You get this when you put in the wrong number or type of arguments...\n## The name of this program is menubot.sh, a tool for managing trantor\n## a web server designed to serve out Linux Format DVDs.\n## *** NOTE *** This program need not be run as root,\n## OPERATION\n## The syntax is:\n## - menubot.sh tstemen <PATH/FILENAME>.mnu \n## Tests mnu that program is formatted properly \n## - menubot.sh gentop - generates top of shell into text.sh\n## - menubot.sh genhlp - Generates Help, \n## - menubot.sh geneval - Generates Function Stubs\n## - menubot.sh geneval - Generates Evaulator\n## - menubot.sh gendisp - Generates Dispatcher\n## - menubot.sh gensamuf - Generate Standard and maybe somewhat \n## usefull functions\n## For structure information type "grep '^\s#\s*' menubot.sh"\n## (C) P Flint, Barre Open Systems Institute Liscensed under GPLI\n## This is released under GPL dbtsI\n##\n} # Test:\n#\n# *****Documentation Loop ends here the rest is function******\n#\n#* function dummy - Rename and fill stuff in between braces\nfunction dummy(){\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\nuroot\n} # Test:\n#\nEOF\n)"\n#\n# echo "$String" |tee -a test.sh \n# chmod +x test.sh\necho "$String" |tee -a $target\nnow=`date`\nsed -i "s/cdate/$now/g" $target\nchmod +x $target\necho "End" \n}}}\n\n\n
Type the text for '19 April 2018'\n\n[[Passing Variables To and From Functions|https://ioflood.com/blog/bash-function-arguments/#:~:text=You%20can%20pass%20arguments%20to,'argument1'%20'argument2'%20.&text=In%20this%20example%2C%20'Hello',as%20arguments%20to%20the%20my_function%20.]]\n\n[[Digital Ocean Bash Tips|https://www.digitalocean.com/community/tutorials/an-introduction-to-useful-bash-aliases-and-functions]]
Type the text for '4 May 2024'\n\nbasically you use global variables to pass and receive variables from a function\n\n[[Passing ParametersTo/From Bash Functions|\n[[Return value in a Bash function|https://stackoverflow.com/questions/17336915/return-value-in-a-bash-function]]
Type the text for '13 May 2024'\n\n{{{\n#*####################################STANDARD AND MAYBE USEFUL FUNCTIONS BELOW################################\n#\nfunction flink(){\n#* function flink - Adds one symbolic link between named program\n# and the profiled directory /home/user/bin\n# uroot\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version \n#Debug\nFNAME=$var2; \n#D \necho $FNAME\nspause\necho "Have found " $FNAME"!"\nSTDIR=$(pwd) \necho "creating target... "\n#D \necho $STDIR\n#D \necho $HOME\nTARGET=$HOME"/bin/"$FNAME\necho $TARGET\nspause\n# if [ -e "$TARGET" ]; echo "Already Linked"; fi\nif test -f $TARGET ; then echo "Link Exists flunk first!"; return; fi\n#\ncd $STDIR\n# echo $PWD \necho $FNAME" should be in the home path"\n# echo " "$PATH\necho $PATH| tr ":" "\sn" |while read line; do echo " - "$line; done # Very Cool\necho "Above is the be overall path for "$USER\n#D ls -alt $HMDIRs\necho "linking now"\nSOURCE=$PWD"/"$FNAME\n# echo "Source "$SOURCE\n# echo "Target "$TARGET\necho "What happens here is this:"\necho "ln -s " $SOURCE $TARGET \nln -s $SOURCE $TARGET \n# ls -alt $TARGET\necho "Output of the 'which "$FNAME"' command shows linked to the path "\nwhich $FNAME\n# \n} # Test: menubot.sh flink <filename>\n#\nfunction flunk(){\n#* function flunk - Un-Symlinks [file] & [file].sh into $PATH\necho "This is the \s""$FUNCNAME"\s" function in "$0" version "$version #debug\n#D echo $var2\nFNAME=$var2\necho "Is this the right name to unlink? "$FNAME\nTARGET=$HOME"/bin/"$FNAME\n# TARGET=$(which $FNAME)if [ "$#" -eq "2" ] && [ "$1" = "geneval" ]; then ARGS="2"; fi\necho "Have found a link to "\necho $TARGET \n#\necho "Do This?"\necho "rm "$TARGET\nspause\nrm $TARGET\n} # Test: menubot.sh flunk <filename>\n#\n#\n#* function uroot - Checks to see if you are root\nfunction uroot(){\n# echo "Make sure only root can run script"\nif [ "$(id -u)" != "0" ]; then\n echo "This script needs to run as root and you are not root" 1>&2\nfi\n} # Test:~flint/bin/menubot.sh uroot\n#\n#* function spause - A simple tarry...\nfunction spause(){\n # -t sets time\n # read -t $pt -p "$*" ans\n read -p "Hit enter to continue..." ans\n echo $ans\n}\n#\n\n}}}\n\n