June 17, 2006

Shell Script For Copying Files

Here’s a simple shell script for copying a file to all the accounts on the same server.  Of course, this can be modified to do just about anything.

#!/bin/sh
accounts=”usernam1 usernam2 usernam3 usernam4″
for account in $accounts
do
cp htaccess.txt /home/$account/public_html/.htaccess
done

In this example accounts is an array of usernames which gets assigned to the variable $account while looping through the accounts array.  This script copies a file called htaccess.txt to .htaccess in each users account.  Fast.

Share:These icons link to social bookmarking sites where readers can share and discover new web pages.
    del.icio.us digg Fark YahooMyWeb Reddit blinkbits BlinkList blogmarks co.mments connotea De.lirio.us feedmelinks Furl LinkaGoGo Ma.gnolia NewsVine Netvouz RawSugar scuttle Shadows Simpy Smarking Spurl TailRank Wists
Filed under Web by admin.
Permalink • Print • 

Leave a comment