|
| HSH.ShellEquivs | | Portability | portable | | Stability | provisional | | Maintainer | John Goerzen <jgoerzen@complete.org> |
|
|
|
| Description |
Copyright (c) 2006-2008 John Goerzen, jgoerzen@complete.org
This module provides shell-like commands. Most, but not all, are designed
to be used directly as part of a HSH pipeline. All may be used outside
HSH entirely as well.
|
|
| Synopsis |
|
|
|
| Documentation |
|
|
| Return the absolute path of the arg. Raises an error if the
computation is impossible.
|
|
|
| Like catTo, but appends to the file.
|
|
|
| The filename part of a path
|
|
|
Changes the current working directory to the given path, executes
the given I/O action, then changes back to the original directory,
even if the I/O action raised an exception.
This is an alias for the MissingH function System.Path.bracketCWD.
|
|
|
Load the specified files and display them, one at a time.
The special file - means to display the input. If it is not given,
no input is read.
Unlike the shell cat, - may be given twice. However, if it is, you
will be forcing Haskell to buffer the input.
Note: buffering behavior here is untested.
See also catFromBS.
|
|
|
| Lazy ByteString version of catFrom. This may have performance
benefits.
|
|
|
| Takes input, writes it to the specified file, and does not pass it on.
The return value is the empty string. See also catToBS, tee.
|
|
|
| Like catTo, but operates in a lazy ByteString. This could be a
performance benefit.
|
|
|
An alias for System.Directory.setCurrentDirectory.
Want to change to a user's home directory? Try this:
glob "~jgoerzen" >>= cd . head
See also bracketCD.
|
|
|
Split a list by a given character and select the nth list.
cut ' ' 2 "foo bar baz quux" -> "bar"
|
|
|
Split a list by a given character and select ranges of the resultant lists.
cutR [2..4] ' ' "foo bar baz quux foobar" -> "baz quux foobar"
cutR [1..1000] ' ' "foo bar baz quux foobar" -> "bar baz quux foobar"
cutR [-1000..1000] ' ' "foo bar baz quux foobar" -> "foo bar baz quux foobar"
Note that too large and too small indices are essentially ignored.
|
|
|
| The directory part of a path
|
|
|
Takes a string and sends it on as standard output.
The input to this function is never read.
See also echoBS.
|
|
|
| ByteString.Lazy version of echo.
|
|
|
| Exits with the specified error code. 0 indicates no error.
|
|
|
Takes a pattern. Returns a list of names that match that pattern.
Handles:
~username at beginning of file to expand to user's home dir
? matches exactly one character
* matches zero or more characters
[list] matches any character in list
[!list] matches any character not in list
The result of a tilde expansion on a nonexistant username is to do no
tilde expansion.
The tilde with no username equates to the current user.
Non-tilde expansion is done by the MissingH module System.Path.Glob.
|
|
|
Search for the string in the lines. Return those that match.
Same as:
grep needle = filter (isInfixOf needle)
|
|
|
| Search for the string in the lines. Return those that do NOT match.
|
|
|
| Search for the regexp in the lines. Return those that match.
|
|
|
| Search for the regexp in the lines. Return those that do NOT match.
|
|
|
| Join lines of a file
|
|
|
|
|
Inverse of double space; drop empty lines
Convert a string to all upper or lower case
|
|
|
Creates the given directory. A value of 0o755 for mode would be typical.
An alias for System.Posix.Directory.createDirectory.
|
|
|
| Number each line of a file
|
|
|
| An alias for System.Directory.getCurrentDirectory.
|
|
|
Return the destination that the given symlink points to.
An alias for System.Posix.Files.readSymbolicLink
|
|
|
| As readlink, but turns the result into an absolute path.
|
|
|
|
|
| Reverse characters on each line (rev)
|
|
|
|
|
| Double space a file
|
|
|
Reverse words on each line
Reverse lines in a String (like Unix tac).
Implemented as:
tac = reverse
See uniq.
|
|
|
Takes input, writes it to all the specified files, and passes it on.
This function buffers the input.
See also teeBS, catFrom.
|
|
|
| Lazy ByteString version of tee.
|
|
|
Translate a character x to y, like:
tr 'e' 'f'
Or, in sed,
y//
|
|
|
| Delete specified character in a string.
|
|
|
| Count number of lines. wc -l
|
|
|
|
|
Remove duplicate lines from a file (like Unix uniq).
Takes a String representing a file or output and plugs it through lines and then nub to uniqify on a line basis.
|
|
| Produced by Haddock version 2.1.0 |