Recent Notes

Displaying keyword search results 1 - 9
Created by Dr. Xi on February 28, 2011 12:29:19    Last update: February 28, 2011 12:30:40
The Unix shell passes these parameters to the shell script: Variable Meaning $* A single string representing all command line arguments separated by $IFS (internal field separator, usually a space) $@ A sequence of strings representing the command line arguments. $1,$2...$n $1 is the first argument, $2 is the second argument, and so on... $0 The name of the script itself. $# The number of arguments. Example shell script ( sharg.sh ): #!/bin/sh echo $# arguments passed to $0: $@ ... Output for ./sharg.sh "a b c d" : 1 arguments passed to ./sharg.sh: a b c d here ... Output for ./sharg.sh a "b c" d : 3 arguments passed to ./sharg.sh: a b c d here ...
Created by woolf on February 10, 2011 13:25:20    Last update: February 10, 2011 13:25:20
If Command Extensions are enabled (which is enabled by default), then there are several dynamic environment variables that can be expanded but which don't show up in the list of variables displayed by SET . These variable values are computed dynamically each time the value of the variable is expanded (but see example below). If the user explicitly defines a variable with one of these names, then that definition will override the dynamic one described below: %CD% - expands to the current directory string. %DATE% - expands to current date using same format as DATE command. %TIME% - expands to current time using same format as TIME command. %RANDOM% - expands to a random decimal number between 0 and 32767. %ERRORLEVEL% - expands to the...
Created by Dr. Xi on December 04, 2009 04:33:05    Last update: December 04, 2009 04:33:05
Variable Meaning $_ The default or implicit variable. @_ Within a subroutine the array @_ contains the parameters passed to that subroutine. $a, $b Special package variables when using sort() $<digit> Contains the subpattern from the corresponding set of capturing parentheses from the last pattern match, not counting patterns matched in nested blocks that have been exited already. $. Current line number for the last filehandle accessed. $/ The input record separator, newline by default. $| If set to nonzero, forces a flush right away and after every write or print on the currently selected output channel. Default is 0 (regardless of whether the channel is really buffered by the system or not; $| tells you only whether you've asked Perl explicitly to flush after...
Created by Dr. Xi on September 10, 2008 15:51:42    Last update: November 26, 2008 21:14:46
Variable Description SET AUTO [COMMIT] {ON | OFF | IMM [EDIATE] | n} Controls when Oracle Database commits pending changes to the database. SET CMDS [EP] {; | c | ON | OFF} Sets the non-alphanumeric character used to separate multiple SQL*Plus commands entered on one line to c. SET CON [CAT] {. | c | ON | OFF} Sets the character you can use to terminate a substitution variable reference if you wish to immediately follow the variable with a character that SQL*Plus would otherwise interpret as a part of the substitution variable name. SET ECHO {ON | OFF} Controls whether the START (@) command lists each command in a script as the command is executed. SET EDITF [ILE] file_name[.ext] Sets the default filename...
Created by Dr. Xi on September 29, 2008 23:05:12    Last update: September 29, 2008 23:06:16
These variables are set or used by the Unix shell to modify its behavior. Variable Description ENV=file Name of script that gets executed at startup; Usually, ENV=$HOME/.kshrc FCEDIT=file Editor used by fc (fix command) command. If $FCEDIT is not defined, use $EDITOR, otherwise use the default (vi or ed). FPATH=dirs Directories to search for function definitions; undefined functions are set via typeset -fu . FPATH is searched when these functions are first referenced. HISTFILE=file File in which to store command history. Default is $HOME/.sh_history for Korn shell, $HOME/.bash_history for Bash. If not set, history is lost after logout. HISTSIZE=n Max number of commands to keep in history. HOME=dir Home directory; set by login from passwd file. IFS='chars' Internal field separators. Default is space, tab, and...
Created by Dr. Xi on September 29, 2008 23:03:40    Last update: September 29, 2008 23:04:08
Variables set automatically by shell: Variable Description $# Number of command-line arguments. $- Options currently in effect (arguments supplied to sh or to set). $? Exit value of last executed command. $$ Process number of current process. $! Process number of last background command. $0 First word; that is, command name. $n Individual arguments on command line (positional parameters). The Bourne shell allows only nine parameters to be referenced directly (n = 1-9); the Korn shell allows n to be greater than 9 if specified as ${n}. $* All arguments on command line ("$1 $2..."). $@ All arguments on command line, individually quoted ("$1" "$2" ...). Variables set automatically by Korn shell: Variable Description ERRNO Error number of last system call that failed. LINENO Current...
Created by Dr. Xi on September 23, 2008 20:43:58    Last update: September 23, 2008 20:43:58
Variable Description $0 The name of the ruby script file $* The command line arguments $$ Ruby interpreter's process ID $? Exit status of last executed child process $_ String last read by gets $. Line number last read by interpreter $! Last error message $@ Location of error $& String last matched by regexp $~ The last regexp match, as an array of subexpressions $n the nth subexpression in the last match (same as $~ ) $= Sase-insensitivity flag $/ Input record separator $\ Output record separator
Created by Dr. Xi on September 17, 2008 03:28:04    Last update: September 17, 2008 03:29:05
Starting with JDK1.5, Java allowed variable arguments (varargs) to methods. You use three dots after the final parameter type to indicate that variable number of arguments may be passed. Varargs can only be used in the final argument position. For example: static int sum (int ... numbers) { int total... Some examples from the Java API: java.text.MessageFormat: public static String format(String pattern, Object... java.lang.String: public static String format(String format, Object.... java.lang.ProcessBuilder: public ProcessBuilder(String... command)
Created by Dr. Xi on September 10, 2008 19:52:55    Last update: September 10, 2008 19:52:55
A substitution variable is preceded by one or two ampersands (&). When you run a SQL command with substitution variables, you'll be prompted for the value of each variable. The one ampersand version prompts for a value and use it for the current query. The two ampersands version uses the value for the current query and remembers it. Just like you did a DEFINE myvar 'The Value' , so you won't be prompted again for subsequent queries using the same variable. To enter a literal ampersand, you need to SET ESC on and use the escape character before the ampersand (&). You can also use substitution variables with a script, but you follow the ampersand by a number instead of a name. When you call...