Unix Shell - Check current dir without whole path?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > February 2006 > Check current dir without whole path?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Check current dir without whole path?
kk_oop@yahoo.com

2006-02-20, 5:54 pm

In a C-Shell script, how would I write an "if" expression that checks
the name of the current directory without checking the whole path?

Thanks!

Ken

Barry Margolin

2006-02-20, 8:49 pm

In article <1140476030.724692.164190@g43g2000cwa.googlegroups.com>,
kk_oop@yahoo.com wrote:

> In a C-Shell script, how would I write an "if" expression that checks
> the name of the current directory without checking the whole path?


`dirname $PWD`

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Bruce Barnett

2006-02-20, 8:49 pm

kk_oop@yahoo.com writes:

> In a C-Shell script, how would I write an "if" expression that checks
> the name of the current directory without checking the whole path?


if ( $cwd:t == tmp ) then
echo current directory is a temp directory
endif



--
Sending unsolicited commercial e-mail to this account incurs a fee of
$500 per message, and acknowledges the legality of this contract.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com