- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- List of if-then-else conditions
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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
02-23-2007 02:27 AM
02-23-2007 02:27 AM
thanks,
hunki
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2007 02:29 AM
02-23-2007 02:29 AM
SolutionConditional Expressions
A conditional expression is used with the [[ compound command to test
attributes of files and to compare strings. Word splitting and file
name generation are not performed on the words between [[ and ]].
(See also the test special command.) Each expression can be
constructed from one or more of the following unary or binary
expressions:
-a file True, if file exists.
-b file True, if file exists and is a block special
file.
-c file True, if file exists and is a character
special file.
-d file True, if file exists and is a directory.
-e file True, if file exists.
-f file True, if file exists and is an ordinary file.
-g file True, if file exists and has its setgid bit
set.
-h file True, if file exists and is a symbolic link.
-k file True, if file exists and has its sticky bit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2007 02:31 AM
02-23-2007 02:31 AM
Re: List of if-then-else conditions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2007 02:32 AM
02-23-2007 02:32 AM
Re: List of if-then-else conditions
# man test
...i.e. the manpages for 'test'...
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2007 02:37 AM
02-23-2007 02:37 AM
Re: List of if-then-else conditions
The if statement allows you to execute one or several commands if a certain condition exists. The syntax is:
if command-line
then conditional_cmd_line1
[else conditional_cmd_line2 ]
fi
if checks for command_line true. (true means command_line returns 0.) If true, conditional_cmd_line1 executes; if not, conditional_cmd_line2 executes.
-h symbolic link for file.
-k file with sticky bit
-x tests for an executable file
-a file exists
-b block special file exists.
-c Chracter special file.
-d directory.
-f ordinary file.
-g setgid bit set for file.
-h symbolic link for file.
-k file True, if file exists and has its sticky bit