A bash script

Stuart Sears stuart at sjsears.com
Thu Jan 6 15:23:14 UTC 2005

On Thursday 06 January 2005 15:14, Chadley Wilson wrote:
> Greetings
> I am about to start a script for installing a couple of updates and I got
> this far :
> #!/bin/sh
> echo "Starting install process ;-)"
> pwd
> Now the very first thing i need, is a thing I can't do
> ha ha!
> The script will run from a folder probably called "updates"
> What I have never worked out was how to make the current working dir a
> variable for this. As this folder could be copied anywhere in the file
> system!
> so the script will have to work regardless of what the absolute path is.
> Endusers can be stupid you know and make 10 copies of the folder before
> getting the updates folder into the correct one.
> I figured I would need to put in  a pwd command.
> but how do you make the script recognise the pwd output as a variable?
> Is there a simple example I cam work from?
the current working directory is already stored in an environment
variable called (shock horror) PWD. (as in 'echo $PWD')
but if you wanted to do it the hard way:
would both do this for you

Stuart Sears RHCE, RHCX
No question is so difficult as one to which the answer is obvious.

More information about the users mailing list