HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- test statement in shell script
Operating System - HP-UX
1828019
Members
2274
Online
109973
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
11-17-2000 01:17 PM
11-17-2000 01:17 PM
I am modifying an existing script, and I have a statement like this:
if [[ -a filename ]] then ....
I have searched and studied and cannot figure out exactly what it means. The documentation tells me that -a is an 'and' operator, but what is it comparing to? Please help, I like to understand what I'm running!
if [[ -a filename ]] then ....
I have searched and studied and cannot figure out exactly what it means. The documentation tells me that -a is an 'and' operator, but what is it comparing to? Please help, I like to understand what I'm running!
No matter where you go, there you are.
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2000 01:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2000 01:36 PM
11-17-2000 01:36 PM
Re: test statement in shell script
The "-a" that you are using is used to check an object.
Using "-a" to test an object will test if it exist.
Example:
if [[ -a name_of_filename ]]
then
echo "file exists"
fi
The -a is also the "AND" operator as used in most scripts.
`fnhalili`
Using "-a" to test an object will test if it exist.
Example:
if [[ -a name_of_filename ]]
then
echo "file exists"
fi
The -a is also the "AND" operator as used in most scripts.
`fnhalili`
derekh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2000 11:39 PM
11-17-2000 11:39 PM
Re: test statement in shell script
Kofi,
The -a test operator works in posix shell as well
example:
[[ -a filename ]] && echo "file exists"
man posix-sh
Best regards,
Dan
The -a test operator works in posix shell as well
example:
[[ -a filename ]] && echo "file exists"
man posix-sh
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
Support
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP