From c3887285abbb3606822626ba396a51cb5df80d43 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 18 Jan 2011 11:46:03 +0000 Subject: [PATCH] fish: 0 && line[n-1] == '\n') + line[n-1] = '\0'; + + pcmd = parse_command_line (line, &exit_on_error); + if (pcmd.status == -1 && exit_on_error) + exit (EXIT_FAILURE); + if (pcmd.status == 1) { + if (issue_command (pcmd.cmd, pcmd.argv, pcmd.pipe, exit_on_error) == -1) { + if (exit_on_error) exit (EXIT_FAILURE); + } + } + } + + free (line); + + if (pclose (pp) == -1) { + perror ("pclose"); + return -1; + } + + return 0; +} + static void cmdline (char *argv[], int optind, int argc) { diff --git a/fish/guestfish.pod b/fish/guestfish.pod index 21f25bd..5ec6689 100644 --- a/fish/guestfish.pod +++ b/fish/guestfish.pod @@ -676,6 +676,32 @@ C. (See C). To change the local directory, use the C command. C will have no effect, due to the way that subprocesses work in Unix. +=head2 LOCAL COMMANDS WITH INLINE EXECUTION + +If a line starts with I!> then the shell command is executed (as +for I), but subsequently any output (stdout) of the shell command +is parsed and executed as guestfish commands. + +Thus you can use shell script to construct arbitrary guestfish +commands which are then parsed by guestfish. + +For example it is tedious to create a sequence of files +(eg. C through C) using guestfish commands +alone. However this is simple if we use a shell script to +create the guestfish commands for us: + + : + + > character so it is +just an ordinary I local command), see what guestfish commands it +would run, and when you are happy with those prepend the C> +character to run the guestfish commands for real. + =head1 PIPES Use CspaceE | command> to pipe the output of the -- 1.8.3.1