Can somebody tell me the difference between if [[ ]] and if [ ] in Unix Shell Scripting?
474019
"[[ ]]" is built-in syntax in some of the shells (ie. ksh)\nfor testing the attributes of files and string. It differs\nfrom "[]" in that word-splitting and file name generation\nare not performed on the words between [[ and ]].\n\nAs a very simple example, consider this trivial script:\n\n#!/bin/ksh\n\nif [ -f cou*.c ] ; then\n  echo Single bracket matched cou*.c\nfi\n\nif [[ -f cou*.c ]] ; then\n  echo Double bracket matched cou*.c\nfi\n\nIf the file "count.c" exists in the current directory,\nthen executing the script results in the following:\n\n$ testit\nSingle bracket matched count.c\n\nNote that the double bracket test did NOT perform\nfile name globbing.
348929
it a method that simply gives you the index of the last element in the array (that is, the "upper bound").\n\nit is useful when you want to loop through the entire contents of an array, like this:\n\nDim Ary(4) As Integer\nDim i as integer            \n\nFor i = 0 to Ary.GetUpperBound(0) ‘Or UBound(Ary)\nAry(i) = i\nNext
706549
Try to read the common inside the code.(inside the "/*.... */")\n\nThis function do couple of things:\n1. It is to check the input command.\n2. Set the parent thread to wait. \n3. Create a child thread.\n4. Use the child thread to run the command.
1059786
you need a PHP interpreter,  there are soem command line interpreetes available that are included with the standard php install.\n\nfrom a command line:\n\n$> php 'SOME_FILE_TO_RUN'
1088393
Historically, the "ps" command read the argv[] array from\neach process to determine its invocation arguments.\nHowever, each process could alter these argument strings\nand thus "lie" to administrators and other users as to which\nprocess was running (as well as which arguments were being\nused).\n\nTo counter this, SysV kernels copy (the first 80 bytes of)\nthe command invocation into a save area in the process\ntable, and *that* is what "ps" uses.   This is why you're\nonly seeing the first 80 characters of the command.  On the\nbright side, you know the data is accurate; on the down\nside, you only see 80 bytes worth.\n\nTo solve your problem with the long command, you can step\nback and use the old mechanism.  You could fall prey to\nsomeone "spoofing" the command line; however, for normal\nprocesses, you'll be able to see the entire invocation.\n\nOn Solaris, the old version of "ps" is in /usr/ucb/ps and\nyou should invoke it with the "-auwwx" option.  The "w"\noption means "wide".  A single "-w" goes to 132 characters,\nbut if you specify *two* "w"'s, then it will print as many\ncharacters as it finds in the argv[] array.  Thus use:\n\n/usr/ucb/ps -auwwx | grep MyJavaProg\n\nIf you're using a different Unix, the path might be\ndifferent, but you might look for either alternate\nversions of "ps" or special options which extract\nthe information from the process rather than the\nkernel.\n\nAn alternative to get the same information is to use the\n/proc utilities.  For example, on newer releases of\nSolaris, the command:\n\n/usr/bin/pargs <some_process_id>\n\nwill print the command line arguments **taken from the\nprocess itself** (not the kernel).  So you could scan all\nprocesses via:\n\ncd /proc\nfor i in * ; do\n/usr/bin/pargs $i\ndone\n\nNote, however, that you will NOT be able to inspect\nother user's processes this way unless you have\nsufficient privilege (ie. execute as "root").  Presumably\nother UNIXes (and Linux) provide similar /proc utilities,\nso the syntax might vary, but the concept should be\nthe same.
94728
well, you didn't specify a language so here's korn shell:\n\n#! /bin/ksh\nread c\nTEMP=1\nwhile [ $TEMP -lt $c ]; do\n  echo "**********************************" | cut -c1-$TEMP\n  let "c += 1"\ndone\n\nmy c++ is a bit rusty, but the loop would look like this:\n\nwhile ( c = 1; c <= count ; c++ )\n{\n  while ( d = 1; d <= c; d++ )\n  {\n    cout << "*";\n  }\n  cout << endl;\n}\n\nhope this helps :-)
881644
Something like this:\n\nint **myArray;\nint s1,s2,i;\n\nprintf("Input row size: ");\nscanf("%d",&s1);\nprintf("Input column size: ");\nscanf("%d",&s2);\n\nmyArray[0] = malloc(s1*s2*sizeof(int));\nif (myArray[0] != NULL ) {\n  for (i = 0;i<s1,i++) {\n         myArray[i] = (i * s2) + myArray[0];\n  }\n}\n\nmyArray can then be used as normal\n\nmyArray[2][4] = 20;
217510
<?= is used as a shortcut to echo or print a variable.\n\n<?=$variable_name;?>\n\nis the same as:\n\n<?print $variable_name;?>
1025321
This should work\n% sh\nsh-2.05b$ a=`ls`\nsh-2.05b$ echo $a\na.c a.out bin conf data env sql src templates upgrade\n\nPutting a command (like ls) in backticks and assigning the same to a variable (like a) lets you store output in a variable for a shell script
675408
The last formula works because you are evaluating the range with an array formula "countblank"\n\nin the original formula you are trying to evaluate a range of values in the condition section of your "if" formula wich is not an "array" fild. This can be done if you conver the formula to an array formula.... Simply hold shift+ctrl when you enter the formula....\n\nthe formula will appears like this\n\n={ IF ( OR ( $C$49:C64=0 ), " ", C64-C63 ) }
187025
use the cacls command.\n\nStart > Run > CACLS /?\n\nThe above command will display the help and file syntax.
757627
=IF(your formula)=0, "", (your formula))\n\nyou could also use the ISBLANK with the IF\n\n=IF(ISBLANK(your formula), "", (your formula))
822848
head -2 threelines | tail -1 threelines\n\n\nI'll break this statement down to explain it\n\nhead -2 threelines :this command displays the first two lines of the file \n this output is sent as a input to the next command ( this is done by |  (pipe)) \n\ntail -1 will display the last line of the output\n\nso if your file is \n\nabc\ncde\nfgh\n\nhead -2 gives\n\nabc\ncde\n\nwhich is the input to tail -1\n\ntail -1 taking this input will give only cde  which the center line in your file \n\nyou can do it using awk also \n\ncat newlines | awk 'NR==2 {print}'\n\nin this you are printing out the lines in the file using cat,piping the output to the awk statement and saying select Number of record=2 and print it out (NR is number of record)
475021
Ok, basically your command is displaying a list of all files in the current directory based modification time that have a file name pattern of fork*.c where the * is any combination of characters followed by a period and then a c.    Next that listing is passed to the cut program which does something about further slimming down the results.  finally all the information is passed to sort which will return results removing any duplicates.    \n\nalright.. well with that said, hopefully that makes sense... now how you could simplify that into 2 commands is a bit beyond my know how but.. but i imagine you could probably use ls and grep only.  grep is a very powerful application and you can do many things with it.. i'd do some research on it and see what you can figure out.
441729
1)\nThe trick to making a script run under csh is\nthat the first line should like like the following:\n\n#!/bin/csh\n\nThere's no need to compile it or give it a special\nextension; just make sure it has the execute bit set.\n\nBy the way, you can set other interpreters the same\nway, for example:\n\n#!/bin/perl\n#!/bin/ksh\n#!/bin/awk\n\n\n2)\nYour use of "expr" is OK except that you're using the\nwrong quote marks.  you need the "back ticks" to\ncause the output of a command to be assigned into\na variable:\n\nmyVariable=1\nmyVariable=`expr $myVariable + 1`\necho $myVariable\n\nOh, yeah, and one other thing is that you appear\nto have inadvertently mixed up using "myVar" and\n"MyVariable".\n\n----------------- more info -------------------\n\nOh, yeah, again ...\n\nI don't much care for csh programming; I think that\nksh is considerably less confusing.  For that matter,\nI don't much care for csh interactively either.  I\nused it for 3 or 4 years (back when the choice was\ncsh or sh), but there's just nothing to recommend csh\nover ksh as far as I'm concerned.\n\nIn any case, I forgot the myriad rules for assigning\nvalues in csh (set, setenv, assigning to lower case\nbut using upper case, blah blah blah).\n\nAlso, when you use /bin/expr, each "value" needs to\nbe a distinct argument -- so put spaces between the\noperands and operators.\n\nHere's my version and a test run:\n\n$ cat script\n#!/bin/csh\n\nset myVariable=1\nset myVariable=`expr $myVariable + 1`\necho $myVariable\n\n\n$ script\n2\n\n\nMaybe using "bc" would be easier:\n\n$ cat script2\n#!/bin/csh\n\necho $* | bc\n\n\n$ script2 1+1\n2\n\n\nHow's that?
990333
I am changing my answer - I misunderstood it -\n\nUse the second form with the arg " " when you do not want to supply an option to grep.
292447
Perl would be my preference.  There are interpereters available for all major platforms (UNIX, Linux, Windows, OSX, etc.), so your scripts will be fairly portable depending on the system calls you use.\n\nThere are many libraries (Perl Modules) available that allow your scripts to do things like connect to databases, access web servers, access mail servers, and more.