Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

parsing /etc/localtime

Posted on 2006-06-01
7
Medium Priority
?
423 Views
Last Modified: 2010-07-27
I want to parse out where /etc/localtime is linked to.  I have:

$_ = `ll /etc/localtime`;

but $_ is still blank after I do this.
0
Comment
Question by:lwinkenb
7 Comments
 
LVL 39

Expert Comment

by:Adam314
ID: 16810541
Don't use $_ to get the output:

@ll=`ll /etc/localtime`;
0
 
LVL 5

Author Comment

by:lwinkenb
ID: 16810880
When I do:
@ll=`ll /etc/localtime`;
print "@ll\n";

Nothing gets printed.
0
 
LVL 17

Expert Comment

by:mjcoyne
ID: 16811137
What output do you get if you type /etc/localtime at the command line?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 5

Author Comment

by:lwinkenb
ID: 16811327
Nothing.  The command I want is 'll /etc/localtime'.
0
 
LVL 5

Author Comment

by:lwinkenb
ID: 16811942
Maybe I need to rephrase the question.  I want to find the time zone that /etc/localtime is symbolically linked to.  For instance, "America/New_York".
0
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
ID: 16812111
if you do

my $result = `ll /etc/localtime` or die "Can not run ll $!\n";

You'll no doubt have it fail because 'll' is more than likely an alias for 'ls -l'

Anyway, there's no need to fork an external process for this, when you can do it in perl

my $link = readlink "/etc/localtime";
print "/etc/localtime is symbolically linked to $link\n";
0
 
LVL 5

Author Comment

by:lwinkenb
ID: 16812223
perfect!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question