newby bash script question
Lennart Sorensen
lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Sat Sep 1 22:22:54 UTC 2007
On Sat, Sep 01, 2007 at 03:59:03PM -0400, Alex Maynard wrote:
> I'm sorry to be posting you what should be a very simple
> bash script question. Somehow I haven't quite been able to find an answer
> to this. (Probably I am picking bad search words on google.)
>
> It boils down to not being able to cd properly inside a bash script.
>
> What I am trying to is to run a script from directory A
> A$./script
> That would have the same effect as using cd to get to directory
> B and then running a file. Specifically, I would like the script to do
> the command line equivalent of:
>
> A$ cd B
> B$ latex file.tex
How about:
#!/bin/bash
pushd B
latex file.tex
popd
> which is my case produces different results then
> A$ latex B/file.tex
>
> because the first way latex would look for other files (such as style
> files) in directory B where they should be but the second way it
> will look for them in A instead where it won't find them.
>
> Sorry for posting such a basic question and thanks very much for any
> suggestions you might have.
--
Len Sorensen
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list