[Novalug] question on scripts and ubuntu

Richard Rognlie rrognlie at gamerz.net
Mon Dec 15 13:23:57 EST 2008


On Mon, Dec 15, 2008 at 01:20:32PM -0500, Bonnie Dalzell wrote:
> 
> i have some folders on my usb connected external drive.
> 
> generally if I am at the command line and I want to access them I have to 
> do a fairly long path in the command:
> 
> for example
> 
> cd /media/USB4/LongDescriptiveFolderName
> 
> I am trying to write a script to do the cd
> 
> Here is an example
> 
> #!/bin/sh
> echo "welcome"
> cd /media/USBDH4
> pwd
> 
> 
> i made it executable with a chmod command
> 
> however when I run it - it reports that it did cd to the partition in 
> question but after it exits i am still in the /home/bdz partition

Right as it should

Anything that a script does is "local" to that script

if you want a script to execute as though it were part of your
shell environment, you might try "."


e.g. 

$ . script/that/does/the/cd


> any suggestions?
> 
> also where is the set up for the contents of the path command stored in 
> Ubuntu? I need to modify it to include /home/bdz/bin

Check /etc/profile

-- 
 /  \__  | Richard Rognlie / Sendmail Ninja / Gamerz.NET Lackey
 \__/  \ | http://www.gamerz.net/~rrognlie    <rrognlie at gamerz.net>
 /  \__/ | Creator of pbmserv at gamerz.net
 \__/    |                Helping reduce world productivity since 1994



More information about the Novalug mailing list