[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Feature Request - prepend to file
From: |
Brock Noland |
Subject: |
Re: Feature Request - prepend to file |
Date: |
Sat, 5 Apr 2008 22:00:08 -0500 |
Eric,
Thanks for your response.
> What shell commands have you been trying? I find the following to be
> relatively simple to do:
>
> { echo header; cat file; } > file1 && mv file1 file
Yes, that's is effectively how I do it when I don't have the script
described below available. However, its not safe. Doing it in a safe
manner requires a script. Furthermore, I have been using the GNU tools
for quite some time and I expect to for the next 40-60 years. Typing
the above every time is a pain and error prone in comparison with a
single command.
> Probably not - the bar for adding new coreutils is rather high.
Yes, I am aware :)
> Since this task can already be accomplished portably in shell, what benefit
> is
> there in adding a non-portable command to repeat the task - you can't rely
> on the new command's existence if you want to be portable to other
> machines.
Correct, this would be a GNU only extension, like many of the
options/tools in coretuils. I personally try to avoid using machines
without the GNU tools. In addition, it would not be portable within
GNU machines until the relevant distributions upgraded. With that
said, I plan on using the GNU coreutils until I am either unable to or
we are using computers in some other manner.
As such, I expect in five or so years I should be able to expect this
command to be available. This should save me (any hopefully others)
much typing and data loss due to race conditions and mistyping.
> Finally, what syntax did you have in mind? It is probably
> possible to write a shell script that has that exact same syntax, but uses
> existing commands, to achieve the task without needing to add a new
> coreutil.
Yes, I have written such a script which does this in a safe manner.
However, if I want to use that script, I have to copy it everywhere.
I'd really like if in five years I can just use it from the command
line.
Respectfully,
Brock