10-24-06 12:21 AM
In article <1161382368.881754.155050@h48g2000cwc.googlegroups.com>,
jhagge@gmail.com wrote:
>I am writing a script using the Bourne shell. I know very little about
>Unix, but am familiar with DOS and writing batch files.
>
>The script will be in a directory - I will call this directory DOGFOOD
>to make my explanation easier.... In DOGFOOD there will be some files
>I want to copy to a specific location on the users hard drive, this is
>the only purpose of the script. The DOGFOOD directory could be
>located anywhere on the hard drive (it will be downloaded from the
>internet so I won't have control over where they save it). I am unsure
>how to reference the DOGFOOD directory in the script so I can copy the
>files in DOGFOOD to where they need to go. My best guess is to create
>a randomly named file in DOGFOOD, then do a find for the file and
>somehow grab the path from the output of find... surely there is a
>better way to do this.
I don't understand this. If you don't know where DOGFOOD is, how
will you create a file in it? If you intend for the user to run this
script while DOGFOOD is his current directory, then you can get
the full path for DOGFOOD with "pwd", which prints the full path
of the current directory.
>
>My other question is similar. This script is running on an OS X
>machine. How do I reference the "system drive" ? On Windows there is
>an environment variable for this. The closest thing I know of in the
>Unix world is ~ for the users home directory, but I need to copy files
>outside of the home directory on the system drive.
>
>Thanks for your help.
>
I'm not entirely sure how OS X does this, but it is supposed be
to UNIX-based, and in UNIX, there is no such thing as "the system
drive", there is only one unified directory tree. Drives as
such are not seen unless you are mounting and unmounting filesystems.
What are you trying to do and why do you need to copy files
outside the user's home directory? Where do you want them to go
and what do you think this will accomplish? Be aware that if it is the
user that is running the script, it is unlikely that he will have
permission to write anywhere besides his home directory (and the
temp directory).
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
[ Post a follow-up to this message ]
|