Say I've got the following pipeline:
cmd1 < input.txt |\
cmd2 |\
cmd4 |\
cmd5 |\
cmd6 |\
(...) |\
cmdN > result.txt
Under certain conditions I would like to add a cmd3 between cmd2 and cmd4. Is there a way to create a kind conditional pipeline without saving the result of cmd2 into a temporary file ? I would think of something like:
cmd1 < input.txt |\
cmd2 |\
(${DEFINED}?
----------- Summary -----------
I need a command/set of commands that can help me simulate a shell terminal via a PHP web page using commandline functions. How can I combine the power of nohup and a while loop to:
start the shell,
execute commands and print output (and errors i.e.
I would like the shell to warn me for potential errors I'm about to make.
How can I prevent a command cmd2 from being executed after cmd1.
For example:
$ tar tf file.tar
$ rm !$
Here, I just forgot that I listed the file instead of extracting its content.
I'm looking for a generic solution, that makes a choice based on the name and return value of the previous command, and on the current co
So, we can execute simultaneous command in the shell by appending '&' to the end of the line and then executing 'wait' to wait for the commands to finish. Is it possible for functions?
What is the difference between the following methods of chaining commands?
cmd1; cmd2
cmd1 && cmd2
Synopsis
wait [ID]
Description
The wait builtin command is used to
* wait for a specific job (asynchronous command) and report its exit status if the ID is given
* wait for all running jobs (asynchronous commands)
Options
There are no options.
Could someone help me with the script below?
I am trying to make a script having just one arguement as a command and then it executes the appropriate code
Code:
#!/bin/bash
if [ "$1" = "listCommands" ]
then
echo "Available commands:"
echo "./exec.sh cmd1"
echo "./exec.sh cmd2"
elif [ "$1" = "cmd1" ]
I've recently installed grc (generic colorizer) to my system via MacPorts, giving me the ability to get colorized output for plenty of commands which by default don't support it (see screenshot below).
I would like to make using grc automatic, how ever not for specific commands, but ever command.
From time to time I want to use vim as scratch pad for commands that I would like to send to a command line shell like psql (Postgres), ghci (Haskell programming language), octave ('calculator'), gnuplot (plot) etc.
The advantages would be that you could put comments next to command lines, directly document your session, incrementally develop command lines, test examples ad-hoc in manuals etc.
P