Class Notes (838,933)
Canada (511,158)
CSC209H1 (41)
Karen Reid (20)
Lecture

jan18c.docx

1 Page
75 Views
Unlock Document

Department
Computer Science
Course
CSC209H1
Professor
Karen Reid
Semester
Winter

Description
 Enviroment Variables  Iterating over arguments: another option o Variables built into shell #!/bin/sh for arg in “[email protected]”; do o Note: variables used in command line also end up here echo $arg $ set done BASH=/local/bin/bash BASHOPTS=checkwinsize:cmdhist:expand_aliases:extquote:for  Quotes and Arguments ce_fignore:hostcomplete:interactive_comments:progcomp:pro mptvars:sourcepath o Iterating over “$*”, “[email protected]”, $*, [email protected] all do different things BASH_ALIASES=() $ cat argquotes BASH_ARGC=() echo 'first example: "$*"' BASH_ARGV=() for arg in "$*"; do … echo $arg fruit=apple done now='$today' today='Wed Jan 16 19:43:01 EST 2013' echo 'second example: $*' for arg in $*; do $ echo $PATH echo $arg /u/clarke/pub/gradebin/2011:/u/mcraig/bin/linux- done gnu:/u/mcraig/bin:/local/bin/X11:/local/bin:/bin:/usr/bin :/local/packages/android-sdk-linux_x86-r12/platform- tools:/u/csc209h/winter/pub/bin:. echo 'third example: "[email protected]"' for arg in "[email protected]"; do o Add current working directory to $PATH echo $arg PATH=$PWD:$PATH done  Set and shift echo 'fourth example: [email protected]' o Previous example of paramaters for arg in [email protected]; do echo $arg o set – assigns position parameters to its arguments done $ set this is fun $ echo $1 $ argquotes cheese pepperoni mushrooms "green olives" this first example: "$*" $ echo $2 cheese pepperoni mushrooms green olives is $ echo $3 second example: $* fun cheese $ set `date` pepperoni $ echo $1 mushrooms Wed green $ echo $2 olives
More Less

Related notes for CSC209H1

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit