[K12OSN] nautilus

Les Mikesell les at futuresource.com
Thu Sep 2 05:37:28 UTC 2004


On Wed, 2004-09-01 at 19:38, Dennis Daniels wrote:
> > But if you are going to do this often, wouldn't
> > it be better to write a little script that takes the file
> > name as an option and copies it to all the right places?
> Les,
> Any tips on what that script would look like? Do you have one in your 
> history file you can share? I'm thinking about homework assignments, 
> links to shared folders and the like. I'm an English teacher and could 
> use a little help. :)

Shell scripts generally do simple text substitutions to create
the same command line you would type yourself for a command.
Something like:

#!/bin/sh
FILE=$1
for DEST in `cat list`
do
 mkdir /home/$DEST/homework 2>/dev/null
 cp -v $FILE /home/$DEST/homework/
done

would take a file named on the command line and deliver it
to the homework folder in each of the destinations listed
in a file literally named 'list' which can be space delimited
or on separate lines.  It is worth spending some time
reading the bash man page to see how the variable substitution
works.

---
  Les Mikesell
   les at futuresource.com






More information about the K12OSN mailing list