Mailinglist Archive: opensuse (3337 mails)

< Previous Next >
Re: [SLE] The "cp" command is skipping files/dirs over nfs
  • From: Brad Bourn <brad@xxxxxxxxxxxx>
  • Date: Wed, 19 Apr 2006 11:36:47 -0600
  • Message-id: <200604191136.47386.brad@xxxxxxxxxxxx>
On Wednesday 19 April 2006 11:24 am, James D. Parra wrote:
> Wow! Yes, this helps a lot. Thank you for the detailed explanation.


np, and because I got curious, I've always wanted to be able to do it in one
command, and I could never get the [&] and [&&] to play together. (the [&]
tells bash to put the command in the background)

So I asked a buddy and he suggested this nice little script to do the job.
(Thanks ahigerd @ #qt on irc.freenode.net)


Title of script is log.sh.

#!/bin/bash
$* 2>&1 | tee $1.out



looks slick! (and tee is a program that captures, and outputs at same time)


so you would just run


log.sh command


or do what the script is doing for you.


command 2>&1 | tee command.out


but if you write this script and put it in /usr/bin, then you can simply run
like above (log.sh command)


wich will output to screen at same time as capturing to command.txt (like my
explination)



then there is the [|] pipe operator which tells bash to take the output of
command to the left of the [|] pipe, and "pipe" it to stdin of the command to
the right.

command | grep "text to look for"

is a VERY common use of [|].


B=)

< Previous Next >
References