Re: BASH issue with spaces in file names..



Le Thu, 04 Dec 2008 08:08:05 +0100, Bill Marcum a écrit :

On 2008-12-04, Laurianne Gardeux <lg@xxxxxxxxxxxx> wrote:

No need of 'ls'.

du -hcs

does the job.
But if you really need the 'ls' command, you can take a pipe:

ls -1 | du -hcs

du doesn't use standard input.
ls | xargs du -hcs
The "-1" argument isn't necessary, because ls produces output in one
column when its standard output isn't a terminal.

Uups. Thank you for the correction. I have testded the wrong commande
above in a test-directory but 'ls' dosn't returned a error-message. So
'du' does the job fine without 'ls'. I expected something like "ls: write
error: cannot connect (pipe)". Is it possible that this error-message is
olny a feature of bash-builtins?

LG
.



Relevant Pages

  • Re: Using cmd-line pipe with and without xargs
    ... 'prog | anotherprog' puts the standard output of prog into ... the standard input of anotherprog." ... The OS supplies the command line arguments in an analogous way. ... what I did was neglect to read stdin from my ...
    (comp.unix.shell)
  • Re: Connecting Fortran code to TCP/IP socket
    ... If you invoke your program with the netcat command the standard input ... Runs "command" with the standard output going to host.example.com:port ...
    (comp.lang.fortran)
  • Re: strict grep when patterns are presented on standard input
    ... > Can strict option/quotes etc. be applied to the grep when it becomes ... > its arguments from standard input in the pipe (i.e. as standard output from ... I can add just another sed command to the pipe ...
    (comp.unix.shell)
  • Re: BASH issue with spaces in file names..
    ... But if you really need the 'ls' command, you can take a pipe: ... du doesn't use standard input. ... column when its standard output isn't a terminal. ...
    (comp.unix.shell)
  • Re: safe scanf( ) or gets
    ... programs which read from standard input and write to ... You don't know about operating systems providing command line ... filter programs. ... on a typical *nix system without using stream filters, e.g. grep, ...
    (comp.lang.c)

Loading