[olug] Unix Tip: SAYING PUT AND EXECUTING ELSEWHERE

Sam Tetherow tetherow at nol.org
Thu Jan 2 02:55:38 UTC 2003


'pushd /dir' and 'popd' are the commands I think you are looking for.

As for the person who didn't understand the need of (cd /dir; 
somecommand), it is really nice for cases where you want to execute a 
command on the local directory without actually being there, for 
instance running a perl script that uses local modules (relative to the 
executable) or anything else that uses the local directory for the 
environement such as .conf files).  In the stated example (cd /etc; ls) 
it doesn't seem all that useful, but (cd 
/some/really/long/path/to/get/to/files; ls) it starts to be evident 
since ls /etc shows all files as /etc/hosts /etc/init.d etc.  


Brian Wiese wrote:

>Wasn't there some command that would let you go off into another shell or
>path for a moment to work on a config file or something, and then one
>could "cd back" to their previous path?  And I believe with the command
>you could go back and forth?  
>
>Or was this possibly only by having a different path during an "su"
>situation, and then logging out of "su root" would bring you back to your
>local user path?
>
>If anyone knows, or esp ktb - I think you taught me this: TIA
>
>peace
>Brian
>
>On Wed, 1 Jan 2003 15:46:55 -0600 (CST)
>Dave Hull <dphull at insipid.com> wrote:
>
>|On Wed, 1 Jan 2003, Unix Guru Universe wrote:
>|
>|> Doing things from the present directory. 
>|> Say, if you want to list all the files 
>|> in /etc directory being in your present 
>|> directory you can do so by typing 
>|> 
>|> $ (cd /etc; ls -l)
>|
>|Whatever happened to good ol' "ls -l /etc" or if you want stay in your
>current 
>|directory while executing scripts in another something equally tricky
>like 
>|"/usr/local/bin/siggen.pl nordquist"?
>|
>|I'm still trying to figure out a situation in which this technique might
>be 
>|more useful than simply using a full path.
>|
>|-- 
>|Dave Hull
>|http://insipid.com
>|
>|Remember when tables crashed (choose your ASCII or non-ascii
>|browser here)?
>|-- Steve Nordquist, Re: RIAA strikes again[Way OFFTOPIC], 05/19/00
>|
>|_______________________________________________
>|OLUG mailing list
>|OLUG at olug.org
>|http://lists.olug.org/mailman/listinfo/olug
>|
>
>
>  Brian Wiese | bwiese at cotse.com | aim: unolinuxguru
>------------------------------------------------------
>  GnuPG/PGP key 0x1E820A73 | "FREEDOM!" - Braveheart 
>------------------------------------------------------  
>This is not about Napster or DVDs. It's about your Freedom.
>  I'll see your DMCA and raise you a First Amendment.
>              http://www.anti-dmca.org
>_______________________________________________
>OLUG mailing list
>OLUG at olug.org
>http://lists.olug.org/mailman/listinfo/olug
>  
>





More information about the OLUG mailing list