LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 10-16-2003, 10:44 PM   #1
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 77
bash script test file operators...


I am reading my gentoo init scripts, and in the one for hdparm I see this construct quite a few times:
Code:
if [ -n "${all_args}" ]
Neither the advanced bash sripting guide nor the manpage for 'test' have any reference to an "-n" operator.

Can anyone tell me what it is testing for?
 
Old 10-16-2003, 11:22 PM   #2
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
-n tests for is string is not null. it's actually in the advanced bash scripting guide under string comparisons.
 
Old 10-17-2003, 12:08 AM   #3
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Original Poster
Rep: Reputation: 77
Jeez...sorry, guess I should have turned the page (so to speak..)

Thanks...
 
Old 10-17-2003, 01:06 PM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
It actually is in "man test" as well. When you search for -n the first hit gets you there....
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script 'test' question linmix Programming 5 11-29-2005 12:49 PM
Bash Script test for empty dir uopjohnson Linux - Software 3 10-07-2005 07:45 PM
? on logical operators in BASH eroica Linux - Software 10 02-01-2005 02:12 PM
Simple webserver test script (bash) somedudeppf Programming 3 01-14-2004 11:30 AM
benchmark test bash script PTBmilo Programming 3 02-14-2003 05:37 PM


All times are GMT -5. The time now is 07:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration