File Descriptor Redirection - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

File Descriptor Redirection

Description:

info = 'Kidman:Nicole:Actor:14, Leafy Drive'; _at_personal = split ... 'Kidman', 'Nicole', 'Actor', '14, Leafy Drive'); UNIX System Programming. Pattern Matching ... – PowerPoint PPT presentation

Number of Views:86
Avg rating:3.0/5.0
Slides: 7
Provided by: jack86
Category:

less

Transcript and Presenter's Notes

Title: File Descriptor Redirection


1
File Descriptor Redirection
This is also useful for printing error messages
echo "Danger! Danger Will Robinson!" 2
Note I/O redirections are parsed in the order
they are encountered, from left to right. This
allows you to do fairly tricky things, including
throwing out standard output, and piping standard
output to a command.
2
Functions
A function is defined using name ()
  commands and is invoked like any other
command name args...
3
Functions
You can redirect a function's I/O, embed it in
backquotes, etc., just like any other command.
Functions differ from external scripts ? the
shell does not spawn a subshell to execute them.
If you set a variable inside a function, the
new value will be visible outside of the
function. A function can use return n to
terminate with an exit status of n.
4
Function Arguments
A function can take command-line arguments, just
like any script. Intuitively enough, these are
available through 1, 2... 9 just like the
main script.
5
Useful Utilities
There are a number of commands that aren't part
of sh, but are often used inside sh scripts.
These include basename basename pathname
prints the last component of pathname basename
/foo/bar/baz prints baz
6
Useful Utilities
dirname The complement of basename
dirname pathname prints all but the last
component of pathname, that is the directory
part pathname dirname /foo/bar/baz Prints
/foo/bar
Write a Comment
User Comments (0)
About PowerShow.com