CS246 Lecture Notes - Lecture 1: Shell Script, Grep, Chmod

75 views2 pages

Document Summary

A shell script is a file that contains a sequence of linux commands, executed as a program. To execute, give it execute permission: chmod u+x basic. Command line: arguments are accessed via: , , . Examples: check whether a word is the dictionary egrep ^$ /usr/share/dicr/words. A good password is one not found in the dictionary. Every program returns a status code when it finished executing. Often we want to make sure an exact number of arguments is provides and if not provided a usage message. Usage message is commonly isolated into own function. The general format for if statements: if [condition ]; then #note: whitespace is important elif [ condition ]; then else fi. Example: we want to rename all . cpp files to . cc for in ; do : sets the variable to each word in given list. Example: payday is the last friday of the month.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents