Complete.Org: Mailing Lists: Archives: linux-help: January 2001:
[linux-help] Re: Quick BASH/Perl Question
Home

[linux-help] Re: Quick BASH/Perl Question

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: linux-help@xxxxxxxxx
Subject: [linux-help] Re: Quick BASH/Perl Question
From: John Reinke <jmreinke@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 10 Jan 2001 17:15:27 -0600 (CST)
Reply-to: linux-help@xxxxxxxxx

On Wed, 10 Jan 2001, Curtis Hawthorne wrote:

> First, in BASH, how do I test for the presence of any
> .log (*.log) file in a directory?  If I do "test -a
> *.log" it says there's too many arguments.

I always use an if contruct, although I guess it's technically still test:

if [ -f *.log ]; then
        echo "File exists"
fi

This tests if the file exists and is a regular file, you can use -d to
test for a directory, etc...

For a quicker reply, I'll let someone else answer the other question,
since my perl is rusty at the moment.


> Second, in Perl what's the easiset way to grab the
> first letter of a string, preferably without splitting
> the whole thing into a letter by letter array?
> 
> Thanks!
> 
> Curtis


-- This is the linux-help@xxxxxxxxx list.  To unsubscribe,
visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi


[Prev in Thread] Current Thread [Next in Thread]