ksh: what does x in front of something mean?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ksh: what does x in front of something mean?
# 8  
Old 10-26-2010
I prefer the double quotes, as it is intuitive and clear. You, too, deserve, code even a newbie can read correctly at a glance.

Even though you do not need it on constants, it dispells any idea that the constant is a variable, and the parity between the constant and variable is enhanced by the common "".
# 9  
Old 10-26-2010
But all this applies only to the test command variety (single brackets), and not to the compound command (double brackets) which should function perfectly fine without the x's. Compare:
Code:
$ ip=
$ if [ $ip = 127.0.0.1 ]; then echo hallo; fi
-bash: [: =: unary operator expected
$ if [[ $ip = 127.0.0.1 ]]; then echo hallo; fi
$

So IMO the x's in the OP's example are superfluous and can be left out.

Last edited by Scrutinizer; 10-26-2010 at 06:28 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Linux

How to add \ in front of $ in a script with vi?

Please help to provide command in vi to add \ in front of $ so it does not interpret next character. rm interfaces/DART/WEB-INF/classes/DART/util/TotalDisconnectUtil$1.class rm interfaces/DART/WEB-INF/classes/DART/util/TotalDisconnectUtil$2.class rm... (3 Replies)
Discussion started by: ywu081006
3 Replies

2. Shell Programming and Scripting

Terminal to the front no matter what

Is there a way to bring the terminal script to the front? I am running this script through OMCEdit which is then running it through Terminal. I have some dialog boxes (using osascript) and the dialog boxes are not coming to the front...Terminal bounces and I have to click on Terminal to see the... (1 Reply)
Discussion started by: mainegate
1 Replies

3. Shell Programming and Scripting

ksh - adding a dynamic value to the front of a line

Hi Forum, Im trying to write some code to read a file, take a certain dynamic value and write it back to the file at the front of every line. For example, file.txt is: SIMPLE=HELLO CONFIDENTIAL=false SENDER=false REQUIRED=true FEEDBACK=false UPDATE=false REQUIRED=false MAPPING=true... (9 Replies)
Discussion started by: ocelot
9 Replies

4. Shell Programming and Scripting

Appending the last few columns to the front

Hi consider this as the first line 00010015 MORGAN STANLEY & CO INCORPORATED N 110 INVESTAR 1 0001OT NJ 201-830-5055 01-Jan-1974 00:00:00 1 01-May-2008 00:00:00 05-Jun-2008 13:34:18 0001 - From SMSRun1_GIDQA02 Consider this as the second line 00010015 MORGAN STANLEY... (3 Replies)
Discussion started by: ragavhere
3 Replies

5. Shell Programming and Scripting

sh, ksh: command to remove front spaces from a string?

dear pro-coders, is there any command out there that takes out the front spaces from a string? sample strings: 4 members 5 members 3 members but it has to be like so: 4 members 5 members 3 members (3 Replies)
Discussion started by: pseudocoder
3 Replies

6. UNIX for Advanced & Expert Users

Front end on Unix

Hi, I would like to develop a user interface on Solaris. Can anybody throw some light on currently available software utilities/ packages..? Thanks in Advance .. JS (4 Replies)
Discussion started by: shibz
4 Replies
Login or Register to Ask a Question