I need to set the table to perforce triggers from the command line on Windows 8.
I am entering the following command and pressing "enter":
C:\Program Files\Perforce>p4 -H localhost -p 1666 -u Administrator -P ** triggers -i
Text cursor moves to a new line as if it awaits the trigger lines. Good so far. I input triggers one by one and when I am done, I have no idea how to tell p4.exe to "flush" my input and save it. What is the correct way of setting triggers in my situation?
Omit the -i and things are much easier: Perforce will bring up your P4EDITOR, which is Notepad by default I think, and you can edit your trigger table in Notepad and then save it.
The -i option allows you to "Read the trigger table from standard input without invoking the editor". The keyword here is table. You have to enter the entire trigger table, in its proper format, not just your triggers. The trigger table starts with a line that contains the following...
Triggers:
...followed by "a list of triggers; one per line. Each trigger line must be indented with spaces or tabs in the form. Each line has four elements..."
So, entering the trigger table from the command line might look something like this (I'm just entering a single trigger in this example):
C:\>p4 triggers -i
Triggers:
example change-submit //depot/... "cmd %changelist%"
C:\>
The sequence is...
"Triggers:" Enter Tab [trigger line] Enter Tab [trigger line] Enter...
...until you are done entering all of your triggers. When you are done, hit Ctrl+C to "flush" your input and save it.
Related
In most command line interface "cli" programs the Option-arrow key combinations allows one to move forwards/backwards a word at a time. But in psql both Option-arrow and Control-Arrow actually insert non printable control characters that corrupt the command. In addition in most CLI programs hitting CTL-A goes to the beginning of the command and CTL-E goes to the end of the command. But in psql those combinations do not have any effect.
Navigating a single character at a time is simply too slow: I can not imagine this were an unsolved problem. What is the configuration needed to get one of those key combinations to skip forward/backward by words not characters?
This is an answer containing the response in the comment by by #Marth. The ~/.inputrc does cause the issue.
# want vi to be the default editor for readline
set editing-mode vi
$if mode=vi
# normal mode
set keymap vi-command
set keymap vi-insert
"\C-n": backward-kill-word
"\C-p": history-search-backward
$endif
I have completely removed the ~/.inputrc now.
typing and executing a single line command in octave cli is simple.
for example a=1.
If one wants to edit this command and execute it again it is possible by navigating the history with the up/down keys.
But when executing a multi line command-script, one can still navigate to a single line and edit it, but how to execute the all script again, without going line by line in the history and "enter" the line?
for example:
for i=1:6
a(i) = i;
end
Is there a way to open the all script in an editor, edit, and re-execute it?
Yes there is, via the history command.
E.g. history -q 3 will display the last 3 commands -- the -q switch means do not prepend line numbers, such that the output is copy-pasteable.
You can also use the -w switch to redirect the output to a file, which you could then modify in your editor and call as a script, as you suggest.
If you're using the GUI, you can also use the history pane to highlight the lines you're interested in (in the order that you want them!), and paste directly into the editor window.
In bash there is a setting (usually on by default) that makes it so that any commands that are preceded by a space aren't recorded into the history file.
Is there anything analogous in psql?
So this is possible.
Add \set HISTCONTROL ignorespace to your .psqlrc file.
Then when you precede a command with a space, say setting a password, it won't be added to the history file.
From the manual:
HISTCONTROL
If this variable is set to ignorespace, lines which begin with a space are not entered into the history list. If set to a value of
ignoredups, lines matching the previous history line are not entered.
A value of ignoreboth combines the two options. If unset, or if set to
none (or any other value than those above), all lines read in
interactive mode are saved on the history list.
How can I create a new database in oracle12c?
I started the oracle using the command sqlplus "/as sysdba".then i tried to create a new database.For that use the command create database.When I give that query and press enter then a number 2 is displayed and nothing happens.I don't know what to do next?
Actually, you can create a database via SQLPlus; I do it all the time; what is happening to the user with the question, is he is entering just part of the create database command, hitting ENTER, and then SQL*Plus displays a "2" meaning it is ready to accept line 2 of the command. SQLPlus will not run the commands until you enter a ";" at the end of a line and press ENTER, or a "/" and press ENTER as the first character on last line.
What you can do is to create an initialization file, say /u01/app/oracle/product/12.1.0/dbs/initbadint1.ora, that might look something like this:
control_files = (/u02/oradata/badint1/badint1control01.ctl,
/u03/oradata/badint1/badint1control02.ctl,
/u04/oradata/badint1/badint1control03.ctl)
diagnostic_dest = /u01/app/oracle/admin/badint1/ddump
db_block_size = 8192
db_name = badint1
and then look at
http://docs.oracle.com/database/121/SQLRF/statements_5005.htm#SQLRF01204
for the full syntax of the create database command.
Then invoke the following in SQL*Plus:
startup nomount pfile=/u01/app/oracle/product/12.1.0/dbs/initbadint1.ora
create database "badint1"
controlfile reuse
maxlogfiles 32
maxdatafiles 1000
-- rest of commands go here ...
;
Once you enter the semicolon and press enter, then Oracle will create the database.
Once that is done, then invoke the following, one at a time, to set up the data dictionary:
#/u01/app/oracle/product/12.1.0/rdbms/admin/catalog
#/u01/app/oracle/product/12.1.0/rdbms/admin/catproc
All the databases have to be created with Database Configuration Assistant, it is possible to create in both command line and GUI interfaces. Also Oracle Corp. strongly recommends to use this tool to create databases.
PS: try to google next time you have a question, its is really easy, I found this after 5 sec I started the search
In Matlab, there is a very nice feature that I like. Suppose I typed the command very-long-command and then a few several commands afterwards. Then later if I need the long command again, I just type very and press the up arrow key, my long command appears. It finds the last command that starts with very. I couldn't do the same in unix command line, when I try to do it, it disregards whatever I typed, and goes back to the last commands in chronological order. Is there a way to do it?
In bash this functionality is provided by the commands history-search-forward and history-search-backward, which by default are not bound to any keys (see here). If you run
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'
it will make up-arrow and down-arrow search backward and forward through the history for the string of characters between the start of the current line and the point. See also this related Stack Overflow question.
In bash, hitting ctrl-r will let you do a history search:
$ echo 'something very long'
something very long
$ # blah
$ # many commands later...
(reverse-i-search)`ec': echo 'something very long'
In the above snippet, I hit ctrl-r on the next line after # many commands later..., and then typed ec which brought me back to the echo command. At that point hitting Enter will execute the command.
You can do the same thing by using "!". For example:
$ echo "Hello"
Hello
$ !echo
echo "Hello"
Hello
However, it is generally a bad idea to do this sort of thing (what if the last command did something destructive?). If you expect you will reuse something, then I suggest you create a shell script and save it away somewhere (whenever I plan to reuse something, I create a script in ~/.local/bin).