210 reputation
210
bio website
location
age
visits member for 3 years, 7 months
seen Feb 21 '13 at 13:43

Sep
22
asked External hard drive not detected, what can be done?
Jun
7
revised How to check whether DNS is working through a browser?
added 3 characters in body
Jun
7
awarded  Teacher
Jun
7
revised How to check whether DNS is working through a browser?
added 1 characters in body
Jun
7
answered How to check whether DNS is working through a browser?
May
30
accepted Looking for Windows 3.11 pdf writer application
May
30
comment Looking for Windows 3.11 pdf writer application
Hi. Thx for the answer. Do you know any postscript printers for windows 3.11? Ghostscript 4.03 prints only 1 page for some reason. Ghostscript 6 I can't install cause it requires "win32s v1.3" and exactly this version of win32s crashes the system. Adding postscript prnters from the control panel and getting their drivers from the Windows311.iso is Ok but it also prints only 1 page.
May
30
revised Looking for Windows 3.11 pdf writer application
added 15 characters in body
May
30
asked Looking for Windows 3.11 pdf writer application
May
13
accepted cleanup after “dd” operation
May
13
comment cleanup after “dd” operation
Thank you for help, now its clear. I'm more or less new to scripting.
May
12
comment cleanup after “dd” operation
My question is: what if after {fd}>"$out" and between dd there a file gets created with the same name? You'll overwrite it or am I missing something? Btw. why not doing filetest via if [ -e "$file" ]?
May
12
awarded  Commentator
May
12
comment cleanup after “dd” operation
You're right. I guess mktemp is indeed better choice, since it guarantees uniqueness of the filename.
May
12
comment cleanup after “dd” operation
sorry, I meant this holds only with first solution in second one the drawback is that the file might get created by dd(say 2G) and then it will discover that such name exists, so it has to delete it. Or maybe I could just return it but with a different name...
May
12
comment cleanup after “dd” operation
The second one is the one I use. In both cases you've described there is a gap between dd and the file existance checking command. If the file gets created in that gap, then we'll overwrite it with dd. If teh excl option is specified with dd then it will not overwrite even in such case. However, on error you won't know whether the file existed and the error occured because of excl or for some other reason. I guess the exit code must be checked, but that's not portable...
May
12
comment cleanup after “dd” operation
${$} is a PID, so its unique. On finishing it is deleted.
May
12
comment cleanup after “dd” operation
in other words create the file with dd and then try to use "mv" it is atomic to rename it to real name, if error occurs then delete the temporerly named file. Put file test before dd to exclude 99% of the cases when file will not be created because it already exists. Trap must be set correctly also, but its minorr
May
12
comment cleanup after “dd” operation
All came up now is this: is safe, but in worst case will create file and then delete it instead of not creating in the first place. set +e; if [ -e "$out" ]; then exit 3; fi; dd if=/dev/zero of="$out${$}" bs=256K count=$(($size*4)) conv=excl || { rm -rf $out${$}; exit 4; } mv -n "$out${$}" "$out" || { rm -rf $out${$}; exit 5; } trap cleanup INT TERM ERR EXIT set -e
May
12
asked cleanup after “dd” operation