CS 288-102 Intensive Programming in Linux Spring 2017 Course Details

cs-288-102
Intensive Programming in Linux
spring 2017
Instructor: C F Yurkoski
Section web site: https://web.njit.edu/~yurkowsk/cs288.html
christopher.f.yurkoski@njit.edu
6-9-15
1
Details
Time: Thursday 6-9:05pm
Room: Weston Hall LECT 2
Credits:3
6-9-15
2
SPECIFIC GOALS FOR THE COURSE
Proficiency in Linux programming
environment, command line interface, Bash
commands, and Bash shell scripting.
Proficiency in C programming language
including types, control flow and functions
using pointers, arrays and structures and I/O.
Understanding Floating point operations.
Knowledge of Standard libraries.
Client/Server Programming
6-9-15
3
Programming languages:  C, bash,
Python.
Textbook: The C Programming Language,
Kernighan and Ritchie, Prentice Hall, 2nd
ed., ISBN: 978-0131103627
Use Internet as bash & Python resource.
Also need access to a Linux host and
laptop.
Texts
6-9-15
4
Grading:
Assessment quiz (1%),
Two tests, (25% each);
 Final exam (40%) - See the registrar's
page for date, time and location.
Some quizzes and some homework
(9%);
Exam questions will be derived from
programming assignments.
6-9-15
5
Logistics
Laptop will be needed in class for quizzes, tests
Moodle will be used to submit work.
Course assignments distributed via a combination
of moodle and website:
https://web.njit.edu/~yurkowsk/cs288.html
Course profile: 
https://courseschedules.njit.edu/
Make up classes will be taught via GotoMeeting
™.
6-9-15
6
errata
NJIT
 policy on missed exams
: There will be no makeup exam(s). You must plan your semester accordingly,
especially if you work. Should you miss exam(s) due to emergency, (a) go to the Dean of students, (b) explain your
situation as to why you had to miss, and (c) ask to issue a memo in the form of email or paper whichever is
convenient. If and when the dean's memo about your missed exam is received, your next test score will be copied
to the missing one. Those who miss final exam will fail in the course unless you demonstrate a true emergency
again through the office of the dean of students. This is the NJIT policy for missed exams. No other policy will be
applied. No exceptions will be made.
NJIT
 policy on video recording class materials
: You may not video record the class materials. You may not put any
video/audio recorded class materials on the Web/Internet. It is against the University policy.
Disagreement
 with exam marking/scores
: If you disagree with your exam scores/marks, you may dispute within a
week of receiving/seeing the graded exam paper. After a week, no exams will be contested.
Grading
 dispute
: If you disagree with your grade, you may contest after the first day but within a week of the
following semester. After a week of the first day of the following semester, no grading dispute will be considered.
The NJIT Honor Code: You are required to read and follow: 
http://studentsenate.njit.edu/wp-
content/uploads/2014/09/university_code_on_academic_integrity.pdf
When a student invokes extenuating circumstances for any reason (late withdrawal from a course, request for a
make-up exam, request for an Incomplete grade) the student should be sent to the Dean of Students. The Dean of
Students will be making the determination of whether extenuating circumstances exist or not and will be notifying
the instructor accordingly. Instructors should never request or accept medical or other documents from students;
such documents need to be submitted by the student to the Dean of Students.  Except for cases determined by
law, an instructor 
is not required 
to accommodate student requests even when extenuating circumstances are
certified by the Dean of Students; however, all efforts should be made to ensure a student-friendly environment.
6-9-15
7
Course Outline
 
https://web.njit.edu/~yurkowsk/SyllabusCS288IntensiveProgrammingfall16.pdf 
STAGE 1 – Fundamental Linux knowledge & bash
Introduction to Linux, Intro to Bash shell scripting - variables, assignments
Bash shell scripting - arrays, lists, functions
Pattern matching with regular expressions (grep/cut)
wget
STAGE 2 –  C Language Introduction
 
 Introduction to types, operators and expressions
 Control flow and functions
Pointers, Arrays, Structures and Unions
I/O
Floating point
STAGE 3 – Common idioms in C
 
Malloc/free and basic structure handling with linked lists
Stacks and heaps
Structure handling with multiple links
Client/Server communication
STAGE 4 – Python
6-9-15
8
Schedule
 
https://web.njit.edu/~yurkowsk/schedule.html
    19 jan - first class
23 feb - test 1
30 march - test 2
27 apr - last class
final: determined by Registrar
final grade posted 16 may
6-9-15
9
Syllabus
https://web.njit.edu/~yurkowsk/Syllabus CS288
Intensive Programming.pdf
6-9-15
10
Shell introduction
Mashey
Bourne
Korn (ksh)
Bash – GNU project
6-9-15
11
Command execution
Built in commands versus executable files
PATH:
 
>: echo $PATH
/afs/cad.njit.edu/linux/anaconda3/an
aconda/bin:/afs/cad/linux/java/bin:/
afs/cad/sw.common/bin:/usr/site/bin:
/usr/ucs/bin:
Relative or absolute
permissions:
>: ls -l  mycmd
-rwxr-xr-- 
1 yurkowsk afs 0 Sep  2
10:50 mycmd*
6-9-15
12
Standard IO
Standard In
Standard out
Standard error
operators <  > >> 2>  - |
` `
;
&& ||
&
6-9-15
13
variables
User defined variables 
= (= 
defines and
assigns a value to a user variable)
- user variables start with a letter or
underscore
positional parameters: 
$[1-9] $0 $# $*
Special variables: 
$$ $? $RANDOM $PATH
variable evaluation 
${name}
6-9-15
14
shell scripts
CLI commands in a executable file
must be executable be in your PATH
# makes a comment
6-9-15
15
Basic commands
cat
paste
cut
grep
read
echo
wc
ls [-l]
chmod
exit
6-9-15
16
echo options
options: -n no newline
escape characters:
\a alert (bell)
\b backspace
\c suppress trailing newline
\e escape
\f form feed
\n new line
\r carriage return
\t horizontal tab
 \v vertical tab
\\ backslash
\
NNN
 the character whose ASCII code is NNN (octal)
\x
nnn
 the character whose ASCII code is the hexadecimal value
nnn (one to three digits)
6-9-15
17
grep syntax
literals
^
$
.
[]
*
6-9-15
18
grep examples
grep a file4
grep sd  file4
grep [ad] file4
grep [a-z] file4
grep "^a" file4
grep "a$" file4
grep d.g  file4
grep d.*g  file4
6-9-15
19
arrays
myarray=(a b c d e f g )
echo ${myarray[*]}
echo ${myarray[3]}
myarray[3]="z"
echo "${myarray[*]}" 
one word
echo "${myarray[@]}" 
multiple words
echo ${#myarray[@]} 
 
number of
elements
6-9-15
20
loops
for variable in list
do
 
some
    thing
done
6-9-15
21
loops (continue)
while expr
do
 
until
 
expr is not
 
true
done
e.g.:
while [ $x != "done" ]; do read x; echo $x; done
6-9-15
22
scope rules in bash
pipe is implemented as a subshell so variables
modified within a pipe’s loop to not retain value.
$ x=1
$ cat /tmp/y |   while read y; do
let x=x+1; done && echo $x
$ cat /tmp/y | (  while read y; do
let x=x+1;
done && echo $x )
6-9-15
23
conditionals
if expr
then
 
 
do this
 
if true
else
 
do
 
this
fi
6-9-15
24
the most basic expressions
afsconnect1-42 ~ >: true
afsconnect1-43 ~ >: echo $?
0
afsconnect1-44 ~ >: false
afsconnect1-45 ~ >: echo $?
1
afsconnect1-46 ~ >:
6-9-15
25
some basic expressions
=
!=
-gt
-ge
-lt
-le
-eq
-ne
6-9-15
26
some expressions related to files
6-9-15
27
functions
function quit {
 
echo exit code $1
 
exit $1
}
echo start $1
quit $RANDOM
echo we don't get here
6-9-15
28
another built in
let y=2
let x=$y
let x=x+1   #  plus other expected arithmetic
operators
echo $x
6-9-15
29
 
submitting homework
submit on Moodle
make sure files are Unix formatted, not
Windows formatted.
(carriage returns and newlines versus just
newlines)
6-9-15
30
homework 1
Write a Bash script, count.sh, which builds a table of counts
for the commands under /bin which start with each
letter.  For example, if there are 3 commands starting with
"a" (alsaumute, arch & awk) while there  may be  2
commands starting with "z" (zcat & zsh).  The first and last
lines your script will print would be:
a 3
...
...
...
z 2
Hint: use loop and array to design and implement this
script.
6-9-15
31
Slide Note
Embed
Share

Learn Linux programming, C language proficiency, Bash scripting, and more in this intensive course taught by Instructor C.F. Yurkoski. The course covers programming in Linux environment, command line interface, C language, client/server programming, and essential programming concepts like pointers, arrays, and structures. Texts include "The C Programming Language" by Kernighan and Ritchie. Grading includes quizzes, tests, and a final exam. Logistics involve using a laptop for in-class activities, Moodle for submissions, and attending makeup classes via GotoMeeting. NJIT policies on missed exams and grading disputes are outlined.

  • Linux programming
  • C language
  • Bash scripting
  • Client/server programming
  • Programming course

Uploaded on Oct 08, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. cs-288-102 Intensive Programming in Linux spring 2017 Instructor: C F Yurkoski christopher.f.yurkoski@njit.edu Section web site: https://web.njit.edu/~yurkowsk/cs288.html 6-9-15 1

  2. Details Time: Thursday 6-9:05pm Room: Weston Hall LECT 2 Credits:3 6-9-15 2

  3. SPECIFIC GOALS FOR THE COURSE Proficiency in Linux programming environment, command line interface, Bash commands, and Bash shell scripting. Proficiency in C programming language including types, control flow and functions using pointers, arrays and structures and I/O. Understanding Floating point operations. Knowledge of Standard libraries. Client/Server Programming 6-9-15 3

  4. Texts Programming languages: C, bash, Python. Textbook: The C Programming Language, Kernighan and Ritchie, Prentice Hall, 2nd ed., ISBN: 978-0131103627 Use Internet as bash & Python resource. Also need access to a Linux host and laptop. 6-9-15 4

  5. Grading: Assessment quiz (1%), Two tests, (25% each); Final exam (40%) - See the registrar's page for date, time and location. Some quizzes and some homework (9%); Exam questions will be derived from programming assignments. 6-9-15 5

  6. Logistics Laptop will be needed in class for quizzes, tests Moodle will be used to submit work. Course assignments distributed via a combination of moodle and website: https://web.njit.edu/~yurkowsk/cs288.html Course profile: https://courseschedules.njit.edu/ Make up classes will be taught via GotoMeeting . 6-9-15 6

  7. errata NJIT policy on missed exams: There will be no makeup exam(s). You must plan your semester accordingly, especially if you work. Should you miss exam(s) due to emergency, (a) go to the Dean of students, (b) explain your situation as to why you had to miss, and (c) ask to issue a memo in the form of email or paper whichever is convenient. If and when the dean's memo about your missed exam is received, your next test score will be copied to the missing one. Those who miss final exam will fail in the course unless you demonstrate a true emergency again through the office of the dean of students. This is the NJIT policy for missed exams. No other policy will be applied. No exceptions will be made. NJIT policy on video recording class materials: You may not video record the class materials. You may not put any video/audio recorded class materials on the Web/Internet. It is against the University policy. Disagreement with exam marking/scores: If you disagree with your exam scores/marks, you may dispute within a week of receiving/seeing the graded exam paper. After a week, no exams will be contested. Grading dispute: If you disagree with your grade, you may contest after the first day but within a week of the following semester. After a week of the first day of the following semester, no grading dispute will be considered. The NJIT Honor Code: You are required to read and follow: http://studentsenate.njit.edu/wp- content/uploads/2014/09/university_code_on_academic_integrity.pdf When a student invokes extenuating circumstances for any reason (late withdrawal from a course, request for a make-up exam, request for an Incomplete grade) the student should be sent to the Dean of Students. The Dean of Students will be making the determination of whether extenuating circumstances exist or not and will be notifying the instructor accordingly. Instructors should never request or accept medical or other documents from students; such documents need to be submitted by the student to the Dean of Students. Except for cases determined by law, an instructor is not required to accommodate student requests even when extenuating circumstances are certified by the Dean of Students; however, all efforts should be made to ensure a student-friendly environment. 6-9-15 7

  8. Course Outline https://web.njit.edu/~yurkowsk/SyllabusCS288IntensiveProgrammingfall16.pdf STAGE 1 Fundamental Linux knowledge & bash Introduction to Linux, Intro to Bash shell scripting - variables, assignments Bash shell scripting - arrays, lists, functions Pattern matching with regular expressions (grep/cut) wget STAGE 2 C Language Introduction Introduction to types, operators and expressions Control flow and functions Pointers, Arrays, Structures and Unions I/O Floating point STAGE 3 Common idioms in C Malloc/free and basic structure handling with linked lists Stacks and heaps Structure handling with multiple links Client/Server communication STAGE 4 Python 6-9-15 8

  9. Schedule https://web.njit.edu/~yurkowsk/schedule.html 19 jan - first class 23 feb - test 1 30 march - test 2 27 apr - last class final: determined by Registrar final grade posted 16 may 6-9-15 9

  10. Syllabus https://web.njit.edu/~yurkowsk/Syllabus CS288 Intensive Programming.pdf 6-9-15 10

  11. Shell introduction Mashey Bourne Korn (ksh) Bash GNU project 6-9-15 11

  12. Command execution Built in commands versus executable files PATH: >: echo $PATH /afs/cad.njit.edu/linux/anaconda3/an aconda/bin:/afs/cad/linux/java/bin:/ afs/cad/sw.common/bin:/usr/site/bin: /usr/ucs/bin: Relative or absolute permissions: >: ls -l mycmd -rwxr-xr-- 1 yurkowsk afs 0 Sep 2 10:50 mycmd* 6-9-15 12

  13. Standard IO Standard In Standard out Standard error operators < > >> 2> - | ` ` ; && || & 6-9-15 13

  14. variables User defined variables = (= defines and assigns a value to a user variable) - user variables start with a letter or underscore positional parameters: $[1-9] $0 $# $* Special variables: $$ $? $RANDOM $PATH variable evaluation ${name} 6-9-15 14

  15. shell scripts CLI commands in a executable file must be executable be in your PATH # makes a comment 6-9-15 15

  16. Basic commands cat paste cut grep read echo wc ls [-l] chmod exit 6-9-15 16

  17. echo options options: -n no newline escape characters: \a alert (bell) \b backspace \c suppress trailing newline \e escape \f form feed \n new line \r carriage return \t horizontal tab \v vertical tab \\ backslash \NNN the character whose ASCII code is NNN (octal) \xnnn the character whose ASCII code is the hexadecimal value nnn (one to three digits) 6-9-15 17

  18. grep syntax literals ^ $ . [] * 6-9-15 18

  19. grep examples grep a file4 grep sd file4 grep [ad] file4 grep [a-z] file4 grep "^a" file4 grep "a$" file4 grep d.g file4 grep d.*g file4 6-9-15 19

  20. arrays myarray=(a b c d e f g ) echo ${myarray[*]} echo ${myarray[3]} myarray[3]="z" echo "${myarray[*]}" one word echo "${myarray[@]}" multiple words echo ${#myarray[@]} number of elements 6-9-15 20

  21. loops for variable in list do some thing done 6-9-15 21

  22. loops (continue) while expr do until expr is not true done e.g.: while [ $x != "done" ]; do read x; echo $x; done 6-9-15 22

  23. scope rules in bash pipe is implemented as a subshell so variables modified within a pipe s loop to not retain value. $ x=1 $ cat /tmp/y | while read y; do let x=x+1; done && echo $x $ cat /tmp/y | ( while read y; do let x=x+1; done && echo $x ) 6-9-15 23

  24. conditionals if expr then do this if true else do this fi 6-9-15 24

  25. the most basic expressions afsconnect1-42 ~ >: true afsconnect1-43 ~ >: echo $? 0 afsconnect1-44 ~ >: false afsconnect1-45 ~ >: echo $? 1 afsconnect1-46 ~ >: 6-9-15 25

  26. some basic expressions = != -gt -ge -lt -le -eq -ne 6-9-15 26

  27. some expressions related to files 6-9-15 27

  28. functions function quit { echo exit code $1 exit $1 } echo start $1 quit $RANDOM echo we don't get here 6-9-15 28

  29. another built in let y=2 let x=$y let x=x+1 # plus other expected arithmetic operators echo $x 6-9-15 29

  30. submitting homework submit on Moodle make sure files are Unix formatted, not Windows formatted. (carriage returns and newlines versus just newlines) 6-9-15 30

  31. homework 1 Write a Bash script, count.sh, which builds a table of counts for the commands under /bin which start with each letter. For example, if there are 3 commands starting with "a" (alsaumute, arch & awk) while there may be 2 commands starting with "z" (zcat & zsh). The first and last lines your script will print would be: a 3 ... ... ... z 2 Hint: use loop and array to design and implement this script. 6-9-15 31

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#