Rakib Mullick wrote: > Yes, right. Then, touch only supposed to change file's timestamp. No? > But, touch also creates a file for us. Not only it creates a file for > us, when it creates a file it takes reference from other files.
Yes. That is what touch does. > So, althrough we're in philosophy of one-tool-do-one-job-well, there > are something else that we can get. What did you mean to say there? That didn't parse for me. It is also to not duplicate functionality in every tool. Otherwise every tool that creates files would need a --mode override. That would definitely be too much. > And if adding --mode option to touch gets really out of philosophy, > then I think we need a new tool to for creating file with all the > options that we might have want. That will truly help us to keep the > philosophy intact. No. That doesn't follow at all. The Unix philosophy isn't just that tools should do one thing and do it well but also that functionality shouldn't be duplicated all over the place. Creating yet another tool to do the task doesn't make sense when you can touch and chmod already. That other tool you propose would be a duplication of chmod. And that is the problem here too. Should every tool that creates files have a --mode override? And for that matter I have yet to see a rationale for using --mode here in a real example that can't be satisified simply by using an appropriate umask. > > Why would one prefer the GNU-specific touch --mode ... > > over the portable combination of touch and chmod? > > Cause its easier to do 'touch --mode xxx filename' than 'touch > filename' and 'chmod xxx'. I disagree. Doing the touch followed by chmod is the more obvious way. And for many decades the standard way. And therefore easier to maintain. > And Eric also pointed out that we will be able to do 'touch -r a -M > b' to create a referenced file with different mode. I am not strongly opposed to having this added to the code. But to me this looks like a solution looking for a problem to solve. It is the type of thing that if I ever saw actually used in a script that I would immediately edit into their standard touch and chmod versions without giving it a second thought. Bob