DOC PREVIEW
UW CSE 303 - Lecture Notes

This preview shows page 1-2-15-16-17-32-33 out of 33 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Lights, camera, action!Scripts(Boring) ExamplesShell variablesCommon errorsCapture command outputSpecial variablesif/elseTesting commandsCommand-line argumentsWhence?USPTO on patents (variations worldwide)USPTO on servicemarksUSPTO on copyrightIntellectual propertyFocusing on copyright: softwareFair use: Copyright Law (1976)Reverse engineering (software)Europe: 1991 Software DirectiveProprietary licensesFree Software FoundationFree software licensesLicenses approved by the OSI…Differences: many and subtlePatent retaliationDRM and TivoizationDid TiVo comply with the license?License compatibility (wikipedia)License proliferation (wikipedia)Documentation licensed?General commentsQuestions?David Notkin  Autumn 2009  CSE303 Lecture 5Lights, camera, action!•Today•More scripting•Social impacts“scripts” in computing come from scripts in the theaterScripts•A script is program whose purpose is to run other programs– a series of commands combined into one file–bash (like most shells) has syntax for writing script programs–if your script becomes big, consider a “real” language•To write a bash script (in brief):–type one or more commands into a file; save it–type a special header in the file to identify it as a script–enable execute permission on the file–run it!•There are other scripting languages ... many others–JavaScript, Python, awk, sed, PHP, perl, …(Boring) Examplesecho "This is my amazing script!"echo "Your home dir is: `pwd`"clearecho "Today's date is `date`, this is week `date "+%V"`.“# this is a comment – next line adds a blank lineechoecho "These users are currently connected:"w | grep -v USER | sortechoecho "This is `uname -s` on a `uname -m` processor."echo "This is the uptime information:"uptimeechoecho "That's all folks!"Shell variables•name=value [declaration and assignment]$name [usage]–Must be written EXACTLY as shown; no spaces allowed–Convention is to use all-uppercase names–Variables have global scope by default•bash$ BEARDAGE=34bash$ NAME="David"bash$ echo $NAME"’s beard is " $BEARDAGEDavid’s beard is 34Common errors•Misspelling a variable name creates a new variable–NAME=David...Name=Daniel # doesn’t change NAME•Previously unnamed variables have an empty value–bash$ echo "Welcome, $name"Welcome, •Assigning a multi-word string requires quotes–NAME="David Notkin"NAME=David Notkin # what happens?Capture command output•variable=`command`–assigns the output of command into the variablebash$ FILE=`ls -1 *.txt | sort | tail -n 1`bash$ echo "Your last text file is: $FILE"Special variables–Automatically defined for you in every bash sessionvariable description $DISPLAYwhere to display graphical X-windows output $HOSTNAMEname of computer you are using $HOMEyour home directory $PATHlist of directories holding commands to execute $PS1the shell's command prompt string $PWDyour current directory $SHELLfull path to your shell program $USERyour user nameif/elseif [ test ]; then # basic if commandsfiif [ test ]; then # if / else if / else commands1elif [ test ]; then commands2else commands3fiThere MUST be a space between if and [ and between [ and test since [ is actually a shell command, not just a characterTesting commandsif [ $USER = "notkin" ]; then echo "Nice beard!"fiLOGINS=`w | wc -l`if [ $LOGINS -gt 10 ]; then echo "attu is very busy right now!"fishell command description =, !=, <, >compares two string variables -n, -ztests whether a string is or is not empty (null) -lt, -le, -eq, -gt, -ge, -necompares numbers: <, <=, ==, >, >= , != -e, -dtests whether a given file or directory exists -r, -wtests whether a file exists and is read/writableCommand-line argumentsif [ "$1" = "-r" ]; then echo "Running in special reverse format."fiif [ $# -lt 2 ]; then echo "Usage: $0 source destination" exit 1 # exit the script, error code 1fivariable description $0name of this script $1, $2, $3, ...command-line arguments $#number of arguments $@array of all argumentsWhence?•To promote the progress of science and useful arts, by securing for limited times to authors and inventors the exclusive right to their respective writings and discoveriesCSE303 Au09 11US Constitution: Article I, Section 8USPTO on patents (variations worldwide)•“A patent for an invention is the grant of a property right to the inventor, issued by the United States Patent and Trademark Office. … The right conferred by the patent grant is … ‘the right to exclude others from making, using, offering for sale, or selling’ the invention in the United States or ‘importing’ the invention into the United States.”•“Utility patents may be granted to anyone who invents or discovers any new and useful process, machine, article of manufacture, or composition of matter, or any new and useful improvement thereof.”01/14/2019 12USPTO on servicemarks•“A trademark is a word, name, symbol, or device that is used in trade with goods to indicate the source of the goods and to distinguish them from the goods of others. A servicemark is the same as a trademark except that it identifies and distinguishes the source of a service rather than a product.”•“Trademark rights may be used to prevent others from using a confusingly similar mark, but not to prevent others from making the same goods or from selling the same goods or services under a clearly different mark.”01/14/2019 13USPTO on copyright•“Copyright is a form of protection provided to the authors of ‘original works of authorship’ including literary, dramatic, musical, artistic, and certain other intellectual works, both published and unpublished. The 1976 Copyright Act generally gives the owner of copyright the exclusive right to reproduce the copyrighted work, to prepare derivative works, to distribute copies ...•“The copyright protects the form of expression rather than the subject matter of the writing. For example, a description of a machine could be copyrighted, but this would only prevent others from copying the description; it would not prevent others from writing a description of their own or from making and using the machine. Copyrights are registered by the Copyright Office of the Library of Congress.”01/14/2019 14Intellectual property•Overall, the intent is to encourage ingenuity and protect those in creative ventures, with the goal of promoting innovation for society•The intent is to encourage


View Full Document

UW CSE 303 - Lecture Notes

Documents in this Course
Profiling

Profiling

11 pages

Profiling

Profiling

22 pages

Profiling

Profiling

11 pages

Testing

Testing

12 pages

Load more
Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?