Timeline for Why does redirection (>) not work sometimes but appending (>>) does?
Current License: CC BY-SA 3.0
20 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 4, 2015 at 10:43 | history | edited | Belmin Fernandez | CC BY-SA 3.0 |
edited body
|
| Oct 13, 2014 at 15:17 | comment | added | M. Rubio-Roy | You might want to check out this: unix.stackexchange.com/questions/25372/… | |
| Dec 7, 2011 at 18:53 | vote | accept | Belmin Fernandez | ||
| Jul 18, 2011 at 7:36 | comment | added | LiuYan 刘研 | I asked a similar question (SELinux + I/O Redirection), wish Riccardo Murri's answer help you too: unix.stackexchange.com/questions/14586/… | |
| Jul 18, 2011 at 7:03 | answer | added | AlexD | timeline score: 2 | |
| Jul 18, 2011 at 5:40 | comment | added | greenoldman | What if you execute redirection twice in a row? Just curiosity, because my understanding is, the file was created after all, just without any content. | |
| Jul 18, 2011 at 0:53 | comment | added | Aaron D. Marasco |
xxd /tmp/users.txt - what's in it? I'm gonna guess for some reason one gives a single LF.
|
|
| Jul 18, 2011 at 0:28 | comment | added | Belmin Fernandez | @Hello71 and @Gilles: Answered your questions above (this question's text is getting lengthy, my apologies). I will get to stribika's trace later today. | |
| Jul 18, 2011 at 0:27 | history | edited | Belmin Fernandez | CC BY-SA 3.0 |
Fixed Gilles' name. Oops.
|
| Jul 17, 2011 at 23:05 | comment | added | Gilles 'SO- stop being evil' |
“While studying for the RHCE”: Is this something you read about in a book, or did you reach this situation on a real machine? Is SELinux in use? Some Linux-on-Linux virtualisation? I second Hello71's request, except please grep /tmp /proc/mounts, and then stribika's request of an strace trace to see what's really going on. Also env | grep '^LD_' please. Oh, and can we rule out active attacks (i.e. a person or program changing things in /tmp while you're doing these experiments)?
|
|
| Jul 17, 2011 at 22:43 | comment | added | stribika |
Try executing this from another shell: strace -p pid_of_shell Then in the first shell do the redirections and check what strace prints. For me the only difference is the O_TRUNC vs O_APPEND open mode. This way you can see if the shell actually calls write with the string you typed. If it does not open the file and does not write the text then your shell is buggy. If all open and write calls are OK then I don't know.
|
|
| Jul 17, 2011 at 21:34 | comment | added | Hello71 |
mount | grep /tmp?
|
|
| Jul 17, 2011 at 21:34 | history | tweeted | twitter.com/#!/StackUnix/status/92708665441792000 | ||
| Jul 17, 2011 at 19:41 | history | edited | Belmin Fernandez | CC BY-SA 3.0 |
added full permissions per comment.
|
| Jul 17, 2011 at 19:35 | comment | added | Belmin Fernandez | Adding that now. I am confused as to how that would be relevant. Can you explain please? | |
| Jul 17, 2011 at 19:33 | comment | added | Caleb | Please give us the full permissions view of the directory. | |
| Jul 17, 2011 at 19:30 | comment | added | Belmin Fernandez |
Just added the file command before and after the IO redirects. Is that sufficient?
|
|
| Jul 17, 2011 at 19:28 | history | edited | Belmin Fernandez | CC BY-SA 3.0 |
showing `file` command before and after
|
| Jul 17, 2011 at 19:24 | comment | added | Caleb |
Can you give us the output of ls -al for /tmp and /tmp/users.txt?
|
|
| Jul 17, 2011 at 19:21 | history | asked | Belmin Fernandez | CC BY-SA 3.0 |