Just scripting shell

The image is an example of how I can follow the notes, homework and references all at once. The Zim has links to Wikipedia as well as other sites on the web and where the arrow is drawn, if you look closely, it is a picture of Feynman which links to a procedure that I use on information, kind of a local AI that functions from the context, my own personal Feynman that answers questions for me.

This is the completed script from before and it is starting to get out of hand. The functions have several parameters with order and it almost requires an interface spec. I wouldn't want to be the one extending this as names with numbers overloading can be quite confusing. Obviously there are vestigial elements and I don't see the utility of cleaning it up if it worked for the task at hand. I think that in the future I will reserve shell scripts for simple matters and use Python or C for anything that has more than 2 functions. It is difficult to read and is surely not easily extensible.

It worked and didn't create a worm hole so I am happy as it integrated the pdfs in the way I wanted and added some topic information for when I review SSC the next time or use it as reference to remember a detail.

The need to sort and use 01 instead of 1 is convenience so I can log2 sort visually or actually it is big O(1) that way, since I am using a parallel optical recognition system.

#!/bin/bash skip_dir=0 ind=`cat index.txt` dat=`date` subdw="/home/motey/Notes/MIT3091SSC" function make_dir { if [ -d $1 ]; then skip_dir=`expr $skip_dir + 1` else mkdir $1 fi } function make_file { if [ -e $1 ]; then skip_dir=`expr $skip_dir + 1` else echo "Content-Type: text/x-zim-wiki">$1 echo "Wiki-Format: zim 0.4">>$1 echo "Creation-Date: 2011-01-24T15:25:50.125345">>$1 fi } # what file,name,date function add_header { if [ -e $1 ]; then dat=`date` echo "====== "$2" ======">>$1 echo "Created "$dat>>$1 else skip_dir=`expr $skip_dir + 1` fi } # what file, what location function add_pdfs { n=`pwd` for z in `ls $1 | grep pdf | grep -v htm | grep -v xml` do m=`basename $z` echo "[[file://"$n"/"$1"/"$z"|"$m"]]">>$2 done } #Zim directory to use, Directory of files,no. function add_sub_category { if [ $3 -lt '10' ]; then echo "[[+Lecture0"$2"]]">>$1".txt" make_dir $1"/Lecture0"$2 make_file $1"/Lecture0"$2".txt" add_header $1"/Lecture0"$2".txt" "Lecture0"$2 $dat add_pdfs $2 $1"/Lecture0"$2".txt" $1 else echo "[[+Lecture"$2"]]">>$1".txt" make_dir $1"/Lecture"$2 make_file $1"/Lecture"$2".txt" add_header $1"/Lecture"$2".txt" "Lecture"$2 $dat add_pdfs $2 $1"/Lecture"$2".txt" $1 fi } for i in `ls -d * | sort -n` do k=`echo $i|cut -d '-' -f1 ` if [ -z $(echo $k | sed -e 's/[0-9]//g') ]; then add_sub_category $subdw $i $k fi done


Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen