[K12OSN] script....or cat help Samba/LDAP

Paul Davison pauldavison at psps.com
Tue Jul 13 12:32:09 UTC 2004


David Trask wrote:

>Hi all,
>
>I'm trying to ge things a little smoother so that I can easily duplicate
>my Samba/LDAP set up for others.  One thing I've done is copied my config
>files to an FTP share so that I can copy them down to the new server.  The
>only problem is that the permissions get shot so I actually have to open
>them.....copy the contents of the file and paste the contents into
>(overwriting) the existing file on the new server.  What I'd like to be
>able to do is something like ...take whatever text is in file "A" and copy
>it over to file "B" and in the process overwrite anything that is
>currently in file "B".  This way I could possibly "batch" or "shell
>script" a whole bunch of files to go where they need to with all the
>changes made ahead of time.  Can this be done?  If so....how?
>
>David N. Trask
>Technology Teacher/Coordinator
>Vassalboro Community School
>dtrask at vcs.u52.k12.me.us
>(207)923-3100
>
>
>_______________________________________________
>K12OSN mailing list
>K12OSN at redhat.com
>https://www.redhat.com/mailman/listinfo/k12osn
>For more info see <http://www.k12os.org>
>  
>
Hi David,

Tar or rsync would allow you to preserve the permissions on those files, 
but if you just want to overwrite files one for one you can use cat with 
a redirect

to replace the contents of 'newfile' with 'originalfile' do:
cat  originalfile > newfile    

to append the contents of 'originalfile' onto the end of 'newfile' do:
cat originalfile >> newfile

Thats about the easiest way I can think of

Paul





More information about the K12OSN mailing list