-
Notifications
You must be signed in to change notification settings - Fork 5
csc349fall19/asgn-samples
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Included are six implementations of a recursive algorithm to calculate the nth Fibonacci number, along with invoking shell scripts for each. You may implement your assignments in one of the following languages: * Python 3.7.4 * Java 12.0.2 * Clojure 1.10.1 (You may assume that the Clojure JARs are in the classpath and that the convenience 'clj' and 'clojure' commands have been configured appropriately.) * Kotlin 1.3.50 (You may assume that the Kotlin lib is in the classpath and that the Kotlin bin is in the path, for JVM-backed Kotlin.) * Node.js 12.10.0 * GNU Bash 5.0.2 (Not that I'd recommend it -- this is very much not what Bash was designed for.) To make automated grading possible, you will additionally need to submit two short shell scripts: one to compile your submission, one to run it. For example, all of the included Fibonacci implementations can be run using: >$ ./compile.sh >$ ./run.sh 12 144 >$ Furthermore: * Submit only source code files as they are. Any directories or compressed files will be ignored. * For record-keeping purposes, you must hand in original source files, not pre-compiled files. * You may not use *any* third party libraries (and your script won't have Internet access when it's run, so you cannot use apt/pip/lein/npm to install them), even if they are installed on Cal Poly's Unix servers. Everything you need to know about Bash scripts to write your own script: * Every Bash script should start with a 'shebang', which tells the shell how to interpret the script: #!/bin/sh This tells the shell to interpret your script using the default interpreter, which, on Linux, is (probably, maybe, hopefully) Bash. * In Bash, basically every value is a string. Bash interprets certain strings as integers, depending on the context, and it has limited support for associative arrays. * In Bash, your average variable is declared like this: mystr="foo" Note the lack of spaces on either side of the assignment operator. * In Bash, once a variable is declared, you reference it by prefacing it with the dollar sign: $mystr * In Bash, you can call a program exactly the same way you would from the command line: echo "Hello, world!" * ...and you can substitute in variables: echo $mystr * But remember, everything in Bash is interpreted as a string, and strings can have spaces in them, which would make Bash interpret them as separate values. So to be safe, we wrap the variable reference in quotes: echo "$mystr" This ensures that even if mystr has spaces in it, it gets treated as one value. * The arguments to a Bash script are variables numbered starting with 1: $1, $2, $3, etc. * So putting that all together, if you need to write a Bash script that runs your Java program, you might do something like: #!/bin/sh java MyProgram "$1" Which says, "This is a Bash script. Run MyProgram, passing it the same, first argument that was passed to you." Everything you don't need to know about Bash scripts to write your own script: http://www.tldp.org/LDP/abs/html/index.html
About
Sample Submission Format
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published