|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
why can't `dd` access /dev/stdout?
Hi All,
I want to get a random number by accessing /dev/urandom. But I get an error $dd if=/dev/urandom of=/dev/stdout bs=4 count=1 dd: opening `/dev/stdout': No such file or directory So, can't `dd` access the device /dev/stdout? Best Regards, PRC Jul 3, 2008 |
|
#2
|
|||
|
|||
|
why can't `dd` access /dev/stdout?
PRC wrote:
Hi All, > I want to get a random number by accessing /dev/urandom. But I get an error Does one of these help? dd if=/dev/urandom bs=4 count=1 | whatever_todo_with_binary_data dd if=/dev/urandom bs=4 count=1 2>/dev/null | od -t x1 -An dd if=/dev/urandom bs=4 count=1 2>/dev/null | od -t x4 -An Janis > $dd if=/dev/urandom of=/dev/stdout bs=4 count=1 dd: opening `/dev/stdout': No such file or directory > So, can't `dd` access the device /dev/stdout? > Best Regards, PRC Jul 3, 2008 |
|
#3
|
|||
|
|||
|
why can't `dd` access /dev/stdout?
Wed, 02 Jul 2008 18:36:52 -0700, PRC wrote:
Hi All, > I want to get a random number by accessing /dev/urandom. But I get an error > $dd if=/dev/urandom of=/dev/stdout bs=4 count=1 dd: opening `/dev/stdout': No such file or directory > So, can't `dd` access the device /dev/stdout? > Best Regards, PRC Jul 3, 2008 I believe dd is close()'ing file descriptor 1, which corresponds to stdout - so /dev/stdout ceases to exist for that process. Fortunately, you can just use: dd if=/dev/urandom bs=4 count=1 IW, dd's output defaults to stdout. |
|
#4
|
|||
|
|||
|
why can't `dd` access /dev/stdout?
2008-07-03, 09:46(-04), Maxwell Lol:
[] Insted of dd if=/dev/urandom You can also use dd </dev/urandom > The if= and of= options provide a humorous backwards compatibility to JCL I don't know of any reason to use them. Perhaps others do. The of= one can be useful in combination with conv=notrunc for shells that don't support 1<(csh). See also the nonstandard (GNU only?) conv=excl/nocreat and iflag/oflag. -- S |
![]() |
| Viewing: Web Development Archives > FAQs > Unix/Linux > why can't `dd` access /dev/stdout? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|