Easily find issues by searching: #<Issue ID>
Example: #1832
Easily find members by searching in: <username>, <first name> and <last name>.
Example: Search smith, will return results smith and adamsmith
Aqua Data Studio / nhilam |
Follow
827
|
FluidShell provides you the capability to view (and execute) previously executed shell commands.
This feature is accomplished by implementing a user friendly history
command (similar to the Bash "history" command).
For instance to view all the previously executed commands, type history
at the FluidShell prompt;
:$ history 1 history 2 \help 3 export | grep HIST 4 export HISTCONTROL=$HISTCONTROL:"ignorespace " 5 export | grep HIST 6 \help 7 history 8 clear 9 sqlhistory 10 echo $HISTCONTROL 11 pwd 12 history 13 ls 14 sendmail 15 export HISTFILE=C:\\Users\\vikram\\.datastudio\\connections\\vikram.history 16 clear 17 history
The shell variables which provide control options to this command can be viewed as follows:
:$ export | grep HIST declare -x CLI_SHELL_LINE_INTERPRETER_EVAL_HISTORY="true" declare -x HISTCONTROL="ignoredups:ignorespace" declare -x HISTFILE="C:\\Users\\vikram\\.datastudio\\connections\\MSSQL Server 2012 on Ferenganar.history" declare -x HISTFILESIZE="500" declare -x HISTSIZE="500"
CLI_SHELL_LINE_INTERPRETER_EVAL_HISTORY
CLI_SHELL_LINE_INTERPRETER_EVAL_HISTORY defines whether command history expansion via !<#>
(<#> is a number or string), will take place or not. If this value is set to "false", then !<#> is not expanded; it's treated as a literal.
HISTCONTROL
HISTCONTROL variable allows you to control how FluidShell stores your command history. You can tell it to ignore duplicate commands and/or to ignore commands that have leading whitespaces. This is especially useful since we tend to use some commands multiple number of times. These duplicate commands can fill up the command history pretty fast, crowding the ones we really might need. We can use the "ignoredups" (default) to ignore duplicate commands.
For example:
:$ history 1 history 2 export | grep HIST
:$ pwd C:/Users/vikram
:$ pwd C:/Users/vikram
:$ pwd C:/Users/vikram
:$ history 1 history 2 export | grep HIST 3 pwd << This command had duplicates and has come only once. 4 history
Note: "ignoredups" will only ignore immediately executed duplicate commands.
We can use "ignorespace" (default) control option to ignore commands that start with space; this is useful when we don't want to record a particular command in the command history. Just add a space at the beginning of the line and the command will not be saved in history.
A third value "ignoreboth" is also supported and is a shorthand for both "ignorespace" and "ignoredups".
HISTFILE
At a physical level, shell command history is stored on a per database server connection basis and is written to <user_home>/.datastudio/connections/.history file when FluidShell exits. If no database server connection is associated with a FluidShell, then the history is stored within the <user_home>/.datastudio/shell.history file. HISTFILE variable allows you to choose a different physical file for storing the command history than the default one (.history).
HISTFILESIZE
HISTFILESIZE variable defines the maximum number of commands that will be retained (in the physical file) by FluidShell when it exits. By default, this value is set to "500" (implying previous 500 commands will be stored and available as history at next start up of the FluidShell).
HISTSIZE
HISTSIZE variable defines the maximum number of commands that will be retained in memory by FluidShell during its run. By default this value is set to "500" (implying previous 500 commands will be stored and available as history during the life time of a FluidShell).
Please note that HISTFILESIZE pertains to the physical storage of command history where as HISTFILE pertains to in-memory storage of command history.
history
command.:$ history 1 history 2 \help 3 export | grep HIST 4 export HISTCONTROL=$HISTCONTROL:"ignorespace " 5 export | grep HIST 6 \help 7 history 8 clear 9 sqlhistory 10 echo $HISTCONTROL 11 pwd 12 history 13 ls 14 sendmail 15 export HISTFILE=C:\\Users\\vikram\\.datastudio\\connections\\vikram.history 16 clear 17 history
You can also filter command history using pipeling and grep such as:
:$ history | grep "export" 2 export grep HIST 3 export | grep HIST 4 export HISTCONTROL=$HISTCONTROL:"erasedups " 5 export | grep HIST 15 export HISTFILE=C:\\Users\\vikram\\.datastudio\\connections\\vikram.history 22 history | grep "export"
:$ history | more 1 history 2 \help 3 export | grep HIST 4 export HISTCONTROL=$HISTCONTROL:"ignorespace " 5 export | grep HIST 6 \help 7 history 8 clear 9 sqlhistory 10 echo $HISTCONTROL . . . (paginated ...) . . . 111 pwd 112 history 113 ls 114 sendmail 115 export HISTFILE=C:\\Users\\vikram\\.datastudio\\connections\\vikram.history 116 clear 117 history | more
2. You can also execute a previous command using the following options:
a) !!
to execute the last command in command history.
For instance:
:$ pwd C:/Users/vikram
:$ !! pwd C:/Users/vikram
b) !<number>
where <number> is the index of a command in the command history. For instance to repeat "\help" command:
:$ !6 \help alias ask autocommit cat cd change clear cli commit compare connect cp csv2excel csv2html csv2json csv2xml declare describe disconnect echo erm exec export fluidshell go grep gunzip gzip help history list ls mkdir more mv open pwd reconnect ren rm rmdir rollback run scp sendmail session sleep source sqlbuffer sqldump sqlexport sqlhistory sqlimport ssh syncdir tail tar tee touch unalias unset unzip zip
Please note using a negative number is permissible and is taken as the index from the last command entry. For instance executing:
:$ history 1 history 2 \help 3 export | grep HIST 4 export HISTCONTROL=$HISTCONTROL:"ignorespace " 5 export | grep HIST 6 \help 7 history 8 clear 9 sqlhistory 10 echo $HISTCONTROL 11 pwd 12 history 13 ls 14 sendmail 15 export HISTFILE=C:\\Users\\vikram\\.datastudio\\connections\\vikram.history 16 clear 17 history
:$ !-4 Sendmail Usage: sendmail [OPTION...] ADDRESS... Try "\help sendmail" for more information.
c) !<string>
where <string> is the initial sequence of this command. Such as:
:$ !se Sendmail Usage: sendmail [OPTION...] ADDRESS... Try "\help sendmail" for more information.
Please note that this will execute the most recent command starting with this sequence.
d) !?
executes the most recent command containing the string . Such as:
:$ !?more history | more 1 history 2 \help 3 export | grep HIST 4 export HISTCONTROL=$HISTCONTROL:"ignorespace " 5 export | grep HIST 6 \help 7 history | more 8 clear 9 sqlhistory 10 echo $HISTCONTROL 11 pwd 12 history 13 ls 14 sendmail 15 export HISTFILE=C:\\Users\\vikram\\.datastudio\\connections\\vikram.history 16 clear 17 history | more
3. Using history –c
command clears all the existing history (new history will still get created) in the current FluidShell. Please note that since the in-memory command history will be deleted by this command, those deleted commands as such will also not appear in the FluidShell history file (database server connection.history) for the current database server connection.
You can customize Shell history command for a server connection or the global FluidShell by configuring the HIST???? options and adding them to the FluidShell initialization script via Server Registration->FluidShell and/or File->Options->FluidShell->Script.
For instance adding export HISTSIZE=999
to the startup script will make sure that the current shell has in-memory capacity of storing last 999 commands.
About AquaClusters Privacy Policy Support Version - 19.0.2-4 AquaFold, Inc Copyright © 2007-2017