: | Index Level | psr |
Syntax | psh Unix.command {~}>{>} {file} item {(t} |
Category | TCL |
Type | Verb |
Description |
executes a Unix command and captures the results in a Pick item.
This command is an alternative to the "sh" verb, which allows capturing the result of the "Unix.command" into a Pick item. The "t" option displays the result on screen, as well as storing it in the specified item. "Unix.command" Any Unix command. If it contains a ">" ("greater than" sign), it is passed down to "sh" with its conventional usage. In this case, the ">" before the Pick item specification must be "escaped" by a tilde (~). Only stdout is captured. To capture stderr, redirect it to stdout (see examples). "file" Optional Pick file name where the item is stored. If not specified, "lst" is used as a default. "item" Item name where the result is stored. If two greater-than signs (>>) are used, with no space in between, the result of the Unix command is appended to the end of the item, if it already exists. |
Options | |
See Also | ! (Unix) |
Example |
psh cal 1992 > tmp 1992
Prints a calendar for the year 1992 and stores it in the item "1992" in the file "tmp". psh cat /usr/pick/myfile > myfile Transfers the file "/usr/pick/myfile" into the Pick item "myfile" in the file "lst" (default). If the file does not exist on Unix, the error message is displayed on the terminal. psh cat /usr/pick/myfile 2>&1 ~> myfile Transfers the file "/usr/pick/myfile" into the Pick item "myfile" in the file "lst" (default). "stderr" is redirected to "stdout" ('2>&1'). Therefore, if the file does not exist, the error message will be in the Pick item. Note the "escape" of the >Pick redirection. psh cc myprog1.c 2>&1 ~> myerrs psh cc myprog2.c 2>&1 ~>> myerrs Stores the error messages produced by the two compilations of "myprog1.c" and "myprog2.c" in the item "myerrs". The second error messages are appended to the end of the first. Note the "escape" of the ">Pick" redirection and the ">>" to append data. psh cd /tmp; exec ls -l > mylist Changes directory, lists it and stores the result in the item "mylist". Note the use of "exec" to avoid creating an intermediate shell. Note also that "cd" is not a Unix command, but a "sh" keyword, and thus cannot be "exec'ed". |
Warnings | |
Compatibility | D3/Unix |
: | Index Level | psr |