Copyright (c) 2006-2007 John Goerzen, email@example.com
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.
|abspath :: FilePath -> IO FilePath|
|Return the absolute path of the arg. Raises an error if the computation is impossible.|
|appendTo :: FilePath -> String -> IO String|
|Like catTo, but appends to the file.|
|basename :: FilePath -> FilePath|
|The filename part of a path|
|bracketCD :: FilePath -> IO a -> IO a|
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.
|dirname :: FilePath -> FilePath|
|The directory part of a path|
|catFrom :: [FilePath] -> String -> IO String|
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.
|catTo :: FilePath -> String -> IO String|
|Takes input, writes it to the specified file, and does not pass it on. See also tee.|
|cd :: FilePath -> IO ()|
An alias for System.Directory.setCurrentDirectory.
Want to change to a user's home directory? Try this:
glob "~jgoerzen" >>= cd . head
See also bracketCD.
|echo :: String -> String -> String|
Takes a string and sends it on as standard output.
The input to this function is never read.
|exit :: Int -> IO a|
|Exits with the specified error code. 0 indicates no error.|
|glob :: FilePath -> IO [FilePath]|
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.
|grep :: String -> [String] -> [String]|
|Search for the string in the lines. Return those that match.|
|grepV :: String -> [String] -> [String]|
|Search for the string in the lines. Return those that do NOT match.|
|egrep :: String -> [String] -> [String]|
|Search for the regexp in the lines. Return those that match.|
|egrepV :: String -> [String] -> [String]|
|Search for the regexp in the lines. Return those that do NOT match.|
|mkdir :: FilePath -> FileMode -> IO ()|
|Creates the given directory. A value of 0o755 for mode would be typical. An alias for System.Posix.Directory.createDirectory|
|pwd :: IO FilePath|
|An alias for System.Directory.getCurrentDirectory|
|readlink :: FilePath -> IO FilePath|
|Return the destination that the given symlink points to. An alias for System.Posix.Files.readSymbolicLink|
|readlinkabs :: FilePath -> IO FilePath|
|As readlink, but turns the result into an absolute path.|
|tee :: [FilePath] -> String -> IO String|
Takes input, writes it to all the specified files, and passes it on.
This function buffers the input.
See also catFrom.
|wcL :: [String] -> [String]|
|Count number of lines. wc -l|
|Produced by Haddock version 0.8|