############################################### Summary of example bash scripts. getFileInfo.sh (formerly bex1.sh) : This script displays the file properties of the specified file. pickScriptToRun*.sh (bex2.sh) : Two implementations of a simple start to a top level script you can use to call other scripts. copyAndSED.sh (bex3.sh) : this is a simple example of looping through the set of files in the current directory. It copies the *.sh files in the cd to the subdirectory ./tmp Note: the following reduces this to : mkdir -p ./tmp LIST="$(ls *.sh)" for i in $LIST do sed '1a\# Add comment' $i > ./tmp/$i done analyzeData - a set of solutions to a prior homework. The finding : a set of scripts related to finding things ... filesUpdated: there are several solutions to a prior scripting assignment asking for a listing of all files modified within a certain number of days. The amount of information displayed is set with a mode param- summary or per user. monitor : a set of solutions to a prior homework. Two params are passed - the interval for updates and a network interface name. Similar to top or vmstat 2 , the script monitors a set of system 'health' information. Two of the solutions include both a Bash and a Python implementation. An additional monitor script was added from the web site tecmint - it is not a monitor in its current form but it does acquire additional information. ############################################### analyzeData.sh : this is an example data analysis script. It is intended to read a data file that contains multiple results (one per line) with each result consisting of a number of fields. The specific example we use is produced by ping: 'ping -c 1000 www.ces.clemson.edu > ping.rawdata' If we run ping only 2 iterations, we should see the following: ping -c 2 www.ces.clemson.edu PING pan.ces.clemson.edu (130.127.200.19) 56(84) bytes of data. 64 bytes from pan.ces.clemson.edu (130.127.200.19): icmp_seq=1 ttl=61 time=11.7 ms 64 bytes from pan.ces.clemson.edu (130.127.200.19): icmp_seq=2 ttl=61 time=15.0 ms --- pan.ces.clemson.edu ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 11.757/13.379/15.001/1.622 ms We want the analysis script to analyze a data file such as ping.rawdata allowing use to specify which field we are interested in. We can redirect the output into a file. So for example, to obtain the RTT samples, The script parameters are: arguement 1: input data file name arguement 2: field start delimiter arguement 3: field stop delimiter arguement 4: output (results) data file name Example using the ping (2 RTT samples) shown above (input in ping.rawdata2) ./analyzeData.sh ping.rawdata time= ' ms' ping.dat The first several lines of ping.rawdata are: PING www.google.com (74.125.30.103) 56(84) bytes of data. 64 bytes from of-in-f103.1e100.net (74.125.30.103): icmp_req=8 ttl=38 time=122 ms 64 bytes from of-in-f103.1e100.net (74.125.30.103): icmp_req=10 ttl=38 time=81.8 ms The first several lines of ping.dat are: 122 81.8 To plot the PDF of the ping time series data: -run plotPDF.m in matlab. It is set to load the data file ping.dat. -If you want to run on octave: 1. sudo apt-get install octave 2. to start octave in gui mode, octave --force-gui 3 the go to the directory with plotPDF and run ############################################### findMean.script : a script that takes a single parameter specifying an input file. The script calls findMean.awk which computes the mean of field 1 of the data file. ############################################### case2.sh case.sh chkargs1.sh chkargs.sh cleanup.sh command_menu.sh copyAndSED.sh copydir.sh copyfiles.sh countdown.sh count.sh dirfiles.sh exampleFDs.sh findMean.awk findMeanWithAwk.sh getFileInfo.sh get-tester-address.sh guessPwd.sh if1.sh if3.sh inter.sh math.sh nullFilter.sh numbersAndStrings.sh out2.sh pickScriptToRun1.sh pickScriptToRun2.sh pushFileUsingSCP.sh readme.txt sampleData.dat sortmerge.sh use-get-tester.sh ./analyzeData: analyzeData1.sh analyzeData2.sh getPingStatsStart.awk getPingStatsWithAwk.sh ping1.out ping.rawdata ./finding: ANNAfilesUpdated.sh CULLUMfilesUpdated.sh JOSEPHfilesUpdated.sh RYANfilesUpdated.sh ./monitors: monitorScriptRunzhen.py monitorScriptRunzhen.sh paul.py paul.sh tecmint_monitor.sh