dd가 stdout으로 출력되지 않는 이유는 무엇입니까?


2

이것은 내가 문제가 발생하는 명령입니다

username@computer /current/working/directory
$ dd if="$filename" bs=1 seek=10 count=10 conv=notrunc status=progress^C
0+0 records in
0+0 records out
0 bytes copied, 1.70242 s, 0.0 kB/s

파일 평가판으로 출력 테스트 (신성?)

username@computer /current/working/directory
$ dd if="$filename" bs=1 seek=10 count=10 conv=notrunc status=progress of=test
22+0 records in
22+0 records out
22 bytes copied, 0.0115305 s, 1.9 kB/s

환경

username@computer  /current/working/directory
$ echo $filename
somefile.ext

username@computer /current/working/directory
$ dd --version
dd (coreutils) 8.26
Packaged by Cygwin (8.26-1)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Paul Rubin, David MacKenzie, and Stuart Kemp.

username@computer /current/working/directory
$ echo $SHELL
/bin/bash

username@computer /current/working/directory
$ bash --version
GNU bash, version 4.4.5(1)-release (x86_64-unknown-cygwin)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

username@computer /current/working/directory
$ stty
speed 38400 baud; line = 0;
start = <undef>; stop = <undef>; lnext = ^Q;
-imaxbel
-echoe -echok -echoctl -echoke

ddstdout 파일 디스크립터 / 스트림으로 출력되는 것으로 보이는 Man 페이지의 관련 섹션 이 기본 동작입니다.

      of=FILE
             write to FILE instead of stdout

이 링크에서 찾은 예제도 다음을 의미합니다. AskUbuntu-dd의 진행 상황을 어떻게 모니터링합니까?

  • Windows 10 Pro x64
  • 사이 그윈
  • 콘에 무 170517

답변:


3

출력 시작시 일부 블록을 건너 뛰라 seek는 문제가있을 수 있습니다 . 어떻게 작동 합니까? 내 우분투에서도 비슷한 명령이 +를 누를 때까지 중단 됩니다.ddstdoutddCtrlC

해결 방법 : seek=10옵션을 제거 하면 작동합니다.

참고 : 입력을 건너 뛰려면을 사용하십시오 skip. 아마도 이것이 당신이 정말로 원하는 것입니다.


쥐! 나는 최근과의 차이점에 대해 알고 있었지만 파일을 읽지 않고 파일에 쓰는 예제에서 매개 변수를 떠날 때 혼란스러워했습니다. stackoverflow.com/a/5586379/1091943 감사합니다!
— Pysis

예,로 변경 skip하고 작동했습니다!
— Pysis

0

줄 끝에 "of = test"라는 단어가 있는데, dd에게 출력을 "test"파일에 쓰도록 지시합니다. 해당 비트를 삭제하면 stdout에 쓰게됩니다.


1
내가 문제가되는 명령 은 다음 호출 테스트 dd의 of=매개 변수가 없는 첫 번째 호출 이며 수동으로 종료하면 레코드가 처리되지 않은 것으로 표시됩니다. 이에 따라 질문 텍스트의 일부를 명확히했습니다.
— Pysis
당사 사이트를 사용함과 동시에 당사의 쿠키 정책과 개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.