Sponsored Content
Top Forums UNIX for Dummies Questions & Answers why put double square brackets in an if clause? Post 302096494 by Perderabo on Thursday 16th of November 2006 02:18:56 AM
Old 11-16-2006
I carelessly phrased that. Yes it sees the ] but the $lines just disappears. It starts out:
if [ $lines -eq 0 ]
The shell replaces $lines with nothing. Now we have:
if [ -eq 0 ]
So yes the ] is there but the test no longer makes sense. This cannot happen with the [[ style.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

square brackets

I would like to substitute a phrase which contains square brackets. change TO how? Thanks (2 Replies)
Discussion started by: gilead29
2 Replies

2. Shell Programming and Scripting

WHy the double square brackets?

One of the senior administrators gave me a shell script to modify and it begins as follows: if ] && ] {more code follows} Why the double square brackets? (10 Replies)
Discussion started by: mojoman
10 Replies

3. Shell Programming and Scripting

Use of double square brackets in ksh

Hi First apologies if this has been raised before. I've got the following in a ksh script: if ] For some reason this does not work. But if I remove the double square brackets to: if This works. I thought ksh supported the ]. Or is there more to it? Thanks in advance. (3 Replies)
Discussion started by: tsu3000
3 Replies

4. Shell Programming and Scripting

Double square brackets question

Hi, I just came across an interesting shell script syntax like the one below: ] && (trap 'rm -rf ${WORK_DIR}/*.$$; echo "\n\nInterrupted !!\n\n"; exit 4' 1 2 3 15) Can someone please explain the code snippet above? The trap command bit is fine but ] && is the hazy part. Generally we use an... (2 Replies)
Discussion started by: King Nothing
2 Replies

5. UNIX for Dummies Questions & Answers

Test command - Two square brackets

Hello, Can someone please explain to me the following line, ] && break I do not understand why two test square brackets are used. Thanks, Shantanu ---------- Post updated at 03:38 PM ---------- Previous update was at 03:35 PM ---------- And, also why there's a $ before (echo $c |... (5 Replies)
Discussion started by: Shan_u2005
5 Replies

6. Shell Programming and Scripting

Delete text between square brackets and also delete those square brackets using sed or awk

Hi All, I have a text file which looks like this: computer programming systems engineering I want to get rid of these square brackets and also the text that is inside these brackets. So that my final text file looks like this: computer programming systems engineering I am using... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies

7. Shell Programming and Scripting

Extract text between two square [..] brackets

Hi All, After searching about this, I could find some solutions but I am not sure why it is not working in my case. I have a text file with contents between two square brackets. The text file looks like this: Use tags when you post any code so others can easily read your code. You can... (2 Replies)
Discussion started by: shoaibjameel123
2 Replies

8. UNIX for Dummies Questions & Answers

Single or double square brackets

Hi frieds, I don't understand the difference between single square bracket and double square brackets in a IF condition. Ex. if ; then RETURNJOB=1 else RETURNJOB=0 fi It run, but this if ]; then RETURNJOB=1 else RETURNJOB=0 fi (4 Replies)
Discussion started by: dogshort
4 Replies

9. Shell Programming and Scripting

Compare the value in between square brackets in file

I wanted to compare the value inside the Squre bracket after Colon ( : ) based on any value(seperated by or operator | ) inside the variable Thread and if match found then wnated to store in output file Input file : 20140320 00:08:43.918 INO 35] - Corporate hub is 20140320 00:08:43.918... (2 Replies)
Discussion started by: nes
2 Replies

10. Shell Programming and Scripting

IF statement with square brackets

Hi All, Hope you all are doing good. Yesterday in my project i came across a scenario which i can not guess why it was working in one region and why it was not in another region. Please find my issue below. I am using AIX version 6.0 of UNIX in my project, in shell scripting i have the... (1 Reply)
Discussion started by: mad man
1 Replies
DICLIBINTRO(3)						     Library Functions Manual						    DICLIBINTRO(3)

NAME
DICLib intro - dictionary access library introduction DESCRIPTION
The dictionary access library provides basic functions for kana-kanji conversion. The following files are prerequisite to using the dic- tionary access library: Header file canna/RK.h An include file that contains data and function declarations for use by the kana-kanji conversion library. Include this file at compile time. Libraries libcanna.a, libcanna.so Kana-kanji conversion libraries. Specify "-lcanna" at link time. SUMMARY
The dictionary access library provides three major categories of functions: i| Code conversion functions Convert character string codes between double-width and single-width characters and between hiragana and katakana. External data and initialization procedures are not required. i| Romaji-kana conversion functions Convert Romaji to kana by using a Romaji-kana conversion table that defines the correspondence between Romaji and kana. The rules of Romaji-kana conversion can be altered by making modifications to this table. i| Kana-kanji conversion functions Convert kana to kanji through continuous clause conversion by using a kana-kanji conversion dictionary that defines the correspondence between readings and words. Kana-kanji conversion can be performed to meet specific applications by making modifications to this dic- tionary. Among all the functions of Japanese input processing, this library performs only data conversion. To be able to enter Japanese text from a keyboard, therefore, it is necessary for users to write a keyboard handling routine within the application program. i| Code conversion functions Rk(w)CvtZen Convert ASCII characters and single-width katakana to double-width characters. RkCvtHan Convert double-width symbols, alphanumeric characters, hiragana, and katakana to single-width characters. RkCvtKana Convert double-width hiragana to double-width katakana. RkCvtHira Convert double-width katakana to double-width hiragana. RkCvtEuc Convert shift JIS code to EUC code. i| Romaji-kana conversion functions RkOpenRoma Open the dictionary to use for Romaji-kana conversion. RkCloseRoma Close the dictionary used for Romaji-kana conversion. RkMapRoma Perform Romaji-kana conversion by using a specified Romaji-kana conversion dictionary. RkCvtRoma Convert an entire character string from Romaji to kana by iteratively using RkMapRoma. i| Kana-kanji conversion functions RkInitialize Initialize the kana-kanji conversion functions. RkFinalize Terminate the kana-kanji conversion functions. RkCreateContext Create a new conversion context. RkDuplicateContext Create a context having the same conversion environment as a specified context. RkCloseContext Close a specified conversion context. RkGetDicList Get the names of dictionaries that can be added to the dictionary list. RkMountDic Mount a dictionary in the dictionary list. RkGetMountList Get the names of the currently mounted dictionaries. (or characters for RkwResize) RkUnmountDic Unmount a specified dictionary from the dictionary list. RkRemountDic Alter the priority order of a dictionary already in the dictionary list. RkBgnBun Convert the reading of a specified length to kanji. RkEndBun Terminate kana-kanji conversion. RkGoTo Set the clause with a specified clause number as the current clause. RkLeft Move the current clause to the clause to its left. RkRight Move the current clause to its right. RkXfer Set the candidate with a specified candidate number as the current candidate. RkNext Set the next candidate as the current candidate. RkPrev Set the previous candidate as the current candidate. RkNfer Set a reading itself as the current candidate. RkResize Change the reading length of the current clause to len bytes. RkEnlarge Enlarge the reading of the current clause. RkShorten Shorten the reading of the current clause. RkStoreYomi Change the reading of the current clause to a specified reading, reconverting the subsequent clauses. RkGetYomi Get the reading of the current clause. RkGetKanji Get the current candidate for the current clause. RkGetKanjiList Get all kanji candidates for the current clause. RkGetStat Get analysis information about the current candidate. RkGetLex Get morphemic information on each word that makes up the current candidate. RkDefineDic Define a specified candidate in a dictionary. RkDeleteDic Delete a specified candidate from a dictionary. DICLIBINTRO(3)
All times are GMT -4. The time now is 07:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy