We have some migration scripts that use ##filename and #filename in SQL*Plus scripts to call another file. (e.g. to call thesql.sql its ##thesql)
I want to understand the difference between the # and the ##.
I have found many answers explaining #filename will call a file from the current directory but nothing about the double #.
FYI: ##filename and ##filename.sql both seem to work because it assumes the extension
I ended up finding the answer on https://www.orafaq.com/wiki/SQL*Plus_FAQ#What_is_the_difference_between_.40_and_.40.40.3F
What is the difference between # and ##?
The # (at symbol) is equivalent to the START command and is used to run SQL*Plus command scripts.
SQL> #myscript.sql
A single # symbol runs a script in the current directory (or one specified with a full or relative path, or one that is found in your SQLPATH or ORACLE_PATH).
## will start a sqlplus script that is in the same directory as the script that called it (relative to the directory of the current script). This is normally used for nested command files. This technique is commonly used by scripts that call subscripts in the ?/rdbms/admin directory. The ## reference does not support relative directory references such as ##dir/file.sql or ##./file.sql.
I just found that START command, like most other SQLPlus commands, can be continued on the next line after you put a dash "-" at the end of the previous line (useful when a script takes many or long arguments). However, this does not work for # or ## - in SQLPlus version 19.3 anyway.
Command line continuation works for both START and # in SQLcl (command line tool from SQL Developer).
Related
I am trying to add to the PATH via the Environment Variable settings windows for python.exe.
I have read the instructions using SetX from the March 3, 2012 discussion about this issue and am worried I will make a mess of my machine, so want to stick with the GUI process.
The directory path is C:\Users\Paul\AppData\Local\Programs\Python\Python37\python.exe.
That is a copy from the addition I made in the System Variables section of the Environment Variables window.
I have labelled the Variable Name as "Python", no quotation marks.
I have checked the path, and it looks good to me, and have rebooted the computer. But I still get the
'python.exe' is not recognized as an internal or external command, operable program or batch file.' error in every directory expect if I am specifically in the Python37 directory.
Any idea what I am doing wrong?
The path environment variable contains one or more paths, separated by semicolons. When you try to execute a command in cmd.exe it checks each path listed in the path variable in order of first to last until it finds the executable or runs out of paths to check.
You can experiment without making permanent changes to your system first. Run cmd.exe and type
set path=%path%;C:\Users\Paul\AppData\Local\Programs\Python\Python37
Running python.exe should now work in any directory in this cmd.exe window.
Unlike other environment variables, path is special and is a merged value from the system and user variables. Since you installed python just for yourself you might as well just use a user variable.
In the system properties where you edit environment variables, if there is no path user variable, create one and set it to C:\Users\Paul\AppData\Local\Programs\Python\Python37 or if it already exists, append ;C:\Users\Paul\AppData\Local\Programs\Python\Python37.
In newer versions of Windows 10 the UI is different and you don't have to add the semicolon because it lets you edit them as separate entries.
I have a C project and I would like to run QAC tool v7.0 from command line. I tried the following option,
C:\qac.exe -via <project_name.prj>
However, when I run the above command. I get an error saying the "VersionTag" is not found. The "VersionTag" string is the first line in the .prj file. I am not sure this is the right way to run this tool. Any help appreciated.
The qac -help is not giving valuable information either. The tool version is pretty old and the company 'Programming Research' behind this tool also has been renamed? to Perforce. They do not have any information about command line invocation either from the existing documentation or webpage.
The QAC utility is the "engine" part of the QAC package, corresponding to a compiler.
It won't be happy being run on command line without a number of environment variables:
QACBIN must point to the bin directory of the QAC package installation;
QACHELPFILES must point to the location of message help files;
QACOUTPUT points to the location where output files will be generated (binary .err file for each source file and textual .met file containing semantic and metric information.
The -via parameter to the command line should point at a text file containing other parameters used by the utility.
The .prj file is a package-level file defining the location of C source files being analysed plus their configuration settings files, among other things. It definitely should not be passed directly as a parameter to the QAC utility.
This should get you started, and other questions need to be more specific.
I have a compiled c++ file that I would like to run from within a temporary directory in ruby:
folder = Dir.mktmpdir
begin
puts folder
File.open("#{folder}/input.xml", 'w') { |file| file.write(builder.to_xml) }
ensure
system '.././program'
FileUtils.remove_entry folder
end
The above code properly creates all the desired file/folder, but does not run the system call, and does not produce an error. I have tried the all of the varieties listed here: Calling shell commands from Ruby but cannot seem to get it to function. If I comment out the file deletion line and manually go and execute the command listed above, the program functions properly. Also, if I instead save the file to the same location as the ./program, the ./program works. What is preventing me from running the command from a sub-folder?
maybe system finding a program has name .././program
try the backtick operator or %x function
puts `.././program`
puts %x{.././program}
I have a simple script that I want to import into another with require, but when I run it from Notepad++ I get the usual error that require produces.
The funny thing is that it worked an hour ago and I did not restart the computer since then.
The files are in the same directory, so the simple file name (without .lua) worked and should still work. (relative path)
Lua runs the script just fine.
this is what I entered in Notepad:
cmd /k lua "$(FULL_CURRENT_PATH)"
Earlier I also had a problem with Penlight, maybe there is some connection, so here it is:
I tried to require"pl" but it failed to find the module. (ran from SciTE, worked prevously)
I tried it in the Lua command line and it worked like a charm.
Tried again in SciTE and voila it worked again.
I have no idea what causes any of them.
ps.: using the lfs module and os.execute("cd /d ...path...") did not work
Lua is searching for your required module in the folders of LUA_PATH. In the script you run via F5, put this statement:
print('current path is:')
os.execute('cd')
require 'someModuleThatDoesntExist'
After printing the "working" forlder (Program Files/Notepad++), it tries to find the required module and fails. The traceback shows that Lua looks through many different folders, none of them being the one containing FULL_CURRENT_PATH, so it can't find the module.
You have several choices:
put your scripts in one of the listed paths
set LUA_PATH in your environment to contain the folder name where your scripts are located
change package.path from your script so it knows where to look for other modules. You could do this by either:
including an extra parameter to your F5, namely CURRENT_DIRECTORY, and make your script take its first command line param (CURRENT_DIRECTORY) to add it to package.path
parse arg[0] when your script starts, to get the folder containing script, and extend package.path
For example with #3, first option, you would use
cmd /k lua "$(FULL_CURRENT_PATH)" "$(CURRENT_DIRECTORY)"
in notepad++ and in your Lua module you would use
thisModuleDir = arg[1]
package.path = thisModuleDir .. ";" .. package.path
require 'yourmodule'
I would like to be able to access the current working directory in my vimrc.
For example, I can access the current file by using %.
Specifically,
I have the following line in my vimrc:
map ,l :!latex %
When it runs everything works fine, except the resulting dvi and other files are stored in my home directory instead of my current working directory.
Any suggestions?
See :help autochdir. Vim can automatically change the current working directory to the directory where the file you are editing lives.
Otherwise, if you want to do this manually, see :help cd and :help lcd.
see :he filename-modifiers
:!latex % -output-directory %:h
Most likely, you're running vim from your home directory, so it is the current for him. The latex command, being invoked from vim, also therefore has the home directory as current.
You probably know this, and want just to extract path from the filename and supply it as an argument to -o option of the latex command. Just use the shell capabilities:
:!latex % -output-directory `dirname "%"`
I am not sure that it's -output-directory option, but you get what you asked for--a directory name of the file you're editing.