mscharrer has asked for the wisdom of the Perl Monks concerning the following question:
system("dd if=/dev/zero of=$SIZE bs=1M count=0 seek=$SIZEMB &>/dev/nul +l})'; # prints to STDERR: 10+0 records in 10+0 records out 10485760 bytes (10 MB) copied, 0.00426433 s, 2.5 GB/s
If I now change the "&>" - which affects STDOUT and STDERR - to "2>" - which only affects STDERR - it works:
system("dd if=/dev/zero of=$SIZE bs=1M count=0 seek=$SIZEMB &>/dev/nul +l})'; # prints nothing
Why is this? It's not a problem but I like to know it anyway. The redirect is handled by the shell (==calling shell (BASH)?) not by perl, isn't it? Please enlighten me.
PS: The dd command is used to create a sparse file. Does someone know how to create sparse files with Perl without using a system command?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: system and &>/dev/null
by Fletch (Bishop) on Oct 09, 2008 at 21:38 UTC | |
|
Re: system and &>/dev/null
by repellent (Priest) on Oct 09, 2008 at 22:23 UTC | |
|
Re: system and &>/dev/null
by Bloodnok (Vicar) on Oct 10, 2008 at 18:13 UTC | |
|
Re: system and &>/dev/null
by broomduster (Priest) on Oct 09, 2008 at 23:24 UTC | |
by duelafn (Parson) on Oct 10, 2008 at 02:21 UTC | |
by mscharrer (Hermit) on Oct 10, 2008 at 07:14 UTC | |
by repellent (Priest) on Oct 10, 2008 at 18:02 UTC | |
by Fletch (Bishop) on Oct 10, 2008 at 18:34 UTC | |
| |
by mscharrer (Hermit) on Oct 11, 2008 at 09:30 UTC |