Sponsored Content
Full Discussion: Birthday Calculation
Top Forums Shell Programming and Scripting Birthday Calculation Post 302272417 by methyl on Tuesday 30th of December 2008 02:01:38 PM
Old 12-30-2008
I agree with fpmurphy. [[ ]] is supported in Posix and required though I personally have only found it useful in the context of "while [[ condition ]]".

[[ and ]] are keywords with strict syntax rules. A keyword starts a command and should not be used in the wrong context or be quoted (or you can get unpredictable results).

[ and ] are commands. (On early unix they were executables).

More importantly.
What goes between [[ and ]] is a "conditional expression" with one set of syntax.
What goes between [ and ] is a simple "test" with a simpler syntax. See "man test" where it you'll see that [ ] is an equivalent to "test".

The two syntaxes are covered in the man page for a Posix shell. As it happens some of the basic syntax is common between the two types of condition giving the (wrong) impression that the syntax is always interchangable.

The big syntax difference is with boolean expressions.


BTW. fpmurphy script gives syntax errors with both Posix sh and ksh because the substring variables are from bash. I'm not convinced that the line starting "if [[" will give the right result either (not tested).
 

4 More Discussions You Might Find Interesting

1. News, Links, Events and Announcements

Happy birthday Linux

Linux has turned 10 . Happy birthday and congrats to the hackers whose labor pains keep giving us new tarballs. (From /. ) (1 Reply)
Discussion started by: mib
1 Replies

2. What is on Your Mind?

UNIX 40th Birthday

A little off topic, as far as not being a critical help issue, but I have been searching about for the OFFICIAL date that is considered the 40th Birthday of UNIX. Some folks mentioned it in March, I think do to a mention on Slashdot of the 40th birthday being this year, but I thought I recall... (1 Reply)
Discussion started by: scotbuff
1 Replies

3. Linux

Happy Birthday Linux :)

The Linux kernel was originally created by Linus Torvalds, a Finnish computer science student, and first announced to the world on August 25, 1991-exactly 20 years ago today. At the time, Torvalds described his work as a "hobby" and contended that it would not be "big and professional" like the GNU... (2 Replies)
Discussion started by: itkamaraj
2 Replies

4. What is on Your Mind?

Happy birthday Neo

Wish you many many happy returns of the day, stay blessed. (1 Reply)
Discussion started by: Akshay Hegde
1 Replies
remove profile(1m)														remove profile(1m)

NAME
remove profile - Removes all profile elements and the profile from the specified name service entry SYNOPSIS
rpccp remove profile profile-entry-name [-s syntax] OPTIONS
Indicates the name syntax of the entry name (optional). The only value for this option is the dce name syntax, which is the default name syntax. Until an alternative name syntax becomes available, specifying the -s option is unnecessary. ARGUMENTS
Indicates the name of the target profile. For an entry in the local cell, you can omit the cell name and specify only the cell-relative name. DESCRIPTION
The remove profile command removes a profile (and all of its elements) from the name service database. The entry name of the profile is required. Privilege Required You need write permission to the CDS object entry (the target profile entry). NOTE
This command is replaced at Revision 1.1 by the dcecp command and may not be provided in future releases of DCE. EXAMPLES
The following commands run RPCCP and remove the profile named /.:/LandS/anthro/molly_o_profile: $ rpccp rpccp> remove profile /.:/LandS/anthro/molly_o_profile RELATED INFORMATION
Commands: add element(1m), remove element(1m), show profile(1m) remove profile(1m)
All times are GMT -4. The time now is 11:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy