Bash Scripting, Globs, and Regular Expressions

[Pages:63]Bash Scripting, Globs,

and Regular Expressions

and grep

and sed

and more?

Labs

Forcelab and Zombielab are out! You will have two weeks to do the next three labs They cover a lot of material

What does a shell do?

Bash scripting

Command string is parsed

$ mv source_file.c destination

Globs/Ranges

Enter commands

1 char *args[]={ 2 "mv", 3 "source_file.c", 4 "destination" 5 }; 6 execvp("mv", args);

Bash loads the arguments and executes the command

Stuff happens

Command Review

Task Show directory contents Change directory Move a file Copy a file Rename a file Execute a binary Print something

Command ls cd directory_name mv file.txt location cp file.txt copy.txt mv file.txt renamed.txt ./binary_file echo "Hello World"

Bash scripting

Sometimes you run the same set of commands many times. Retyping commands isn't very much fun

Unless you like typing I don't like typing

There's a simple solution...

Solution?

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download