HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: UNIX SHELL TEST COMAND OPTIONS
Operating System - HP-UX
1834150
Members
2448
Online
110064
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2000 09:34 AM
12-29-2000 09:34 AM
I'm a Unix shell script newbie, I have been using the test command in the following format
[ -option directory/file ], the options I have read about are :
File test:
-r,-w,-x,-f,-d,-s,-t,
String Test:
-z, -n , !, -a, -o and str = str1 compare
The question: I keep finding other options used : -e in particular. Please advise on what options I'm missing and what they check?
The ones I listed above I have found documentation. I usually see others used in script from long gone programmers.
Happy New Year and Thanks
Dave
[ -option directory/file ], the options I have read about are :
File test:
-r,-w,-x,-f,-d,-s,-t,
String Test:
-z, -n , !, -a, -o and str = str1 compare
The question: I keep finding other options used : -e in particular. Please advise on what options I'm missing and what they check?
The ones I listed above I have found documentation. I usually see others used in script from long gone programmers.
Happy New Year and Thanks
Dave
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2000 09:51 AM
12-29-2000 09:51 AM
Solution
The test command does have it's own man page which will list most of the common options. Along with that shells also may use a built-in test function. To know what options are supported you'll need to reference the man page for the shell your using, posix, ksh, csh, bash, etc. Also, knowing which version of the shell your using is helpful, as newer versions usually support additional features.
-e in the posix shell is used for testing if the file exists.
-e in the posix shell is used for testing if the file exists.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2000 10:01 AM
12-29-2000 10:01 AM
Re: UNIX SHELL TEST COMAND OPTIONS
Most of the script written by the programmer was posix verion.
Thanks
Dave
Thanks
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2000 02:02 AM
12-30-2000 02:02 AM
Re: UNIX SHELL TEST COMAND OPTIONS
Hi David,
Here are the additional test flags for the posix shell:
-L file True if file is a symbolic link.
-e file True if file exists.
file1 -nt file2
True if file1 is newer than file2.
file1 -ot file2
True if file1 is older than file2.
file1 -ef file2
True if file1 has the same device and i-node number as file2.
# man 1 test
should give you a fairly complete list of all non-posix flags.
Best regards,
Dan
Here are the additional test flags for the posix shell:
-L file True if file is a symbolic link.
-e file True if file exists.
file1 -nt file2
True if file1 is newer than file2.
file1 -ot file2
True if file1 is older than file2.
file1 -ef file2
True if file1 has the same device and i-node number as file2.
# man 1 test
should give you a fairly complete list of all non-posix flags.
Best regards,
Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP