Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Open Source > Linux
|
Linux General discussion of programming the various flavors of Linux operating systems.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Linux section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 6th, 2006, 11:27 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default -s command in Unix

Code:
if (-s "/dataupload/parsers/broadband/picco/picco.txt") 
{
...code
}
i cant seem to find out what the -s does???

Picco

www.crmpicco.co.uk
www.ie7.com
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old November 14th, 2006, 11:48 AM
Friend of Wrox
 
Join Date: Dec 2003
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

erm...

If this is a bash script then
Code:
if [-S "/dataupload/parsers/broadband/picco/picco.txt"]
then
  #do something
fi
Would test if the file in question was a socket. Maybe its perl, tho'

Code:
if (-s "/dataupload/parsers/broadband/picco/picco.txt") 
{
  # do something
}
Would test for the size of a file and return true if it was greater than 0 bytes. if it is perl you'd be better off doing

Code:
if (-e "/dataupload/parsers/broadband/picco/picco.txt" && 
    -f "/dataupload/parsers/broadband/picco/picco.txt")
{
  # do something
}
To see if the file exists (-e) and is a regular file (-f).

If it isn't perl or bash then you might need to let us know what it is!

--
Don't Stand on your head - you'll get footprints in your hair
                                           http://charlieharvey.org.uk
                                              http://charlieharvey.com
 
Old November 16th, 2006, 08:41 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

thanks. yeah, its a Perl script. how do you mean test if it was a socket?

www.crmpicco.co.uk
www.ie7.com
 
Old November 22nd, 2006, 07:38 AM
Friend of Wrox
 
Join Date: Dec 2003
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey crmpicco,

A socket is a secial type of file that lets you write accross the network. There's an intro at:

http://www.devshed.com/c/a/Perl/Sock...mming-in-PERL/

Cheers

--
Don't Stand on your head - you'll get footprints in your hair
                                           http://charlieharvey.org.uk
                                              http://charlieharvey.com
 
Old November 28th, 2006, 12:10 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

thanks for that Charlie, interesting article


www.crmpicco.co.uk
www.ie7.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Command text was not set for the command object Sheraz Khan Classic ASP Databases 2 May 29th, 2007 12:57 AM
about "UNIX" Thierrypp2006 BOOK: Beginning Unix ISBN: 0-7645-7994-0 2 October 9th, 2006 11:23 PM
Run unix command throu a jsp page kvingupta JSP Basics 2 July 20th, 2006 07:01 PM
Command text was not set for the command object. deepa12 BOOK: Beginning ASP 3.0 5 November 2nd, 2004 05:37 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.