Octave shows echo "octave:#>" before command line in interactive mode where # is the order of the entry. I want to use a program that uses it so I want to cancel that echo. How can I do this?
This is called command prompt. You can set the PS1 to the empty string with:
PS1("")
For more info: https://www.gnu.org/software/octave/doc/interpreter/Customizing-the-Prompt.html
Related
I want to launch a particular URL in chrome every day at the same time. How can I achieve this using command line?
There are two ways to do this. The first being from a single command line. You will want to create a new task in Task Scheduler and have it run a command at a desired time. If you wish to use a different browser that supports command lines, be sure to use _ for any spaces in the directory path.
Command line:
SchTasks /Create /SC DAILY /TN "New_Task" /TR "start "C:\Program_Files_(x86)\Google\Chrome\Application\chrome.exe" www.stackoverflow.com" /ST 09:00
The second option is to use a batch file you store somewhere and it will be called to using the SchTasks. Simply create the site1.bat and place it somewhere safe example C:\Windows\My Tasks.
From Batch:
#ECHO OFF
#set Task_Name=Task1
#Set Time=09:00
#set Site=www.stackoverflow.com
schtasks /query /TN "%Task_Name%" >NUL 2>&1
IF %ERRORLEVEL% EQU 0 (goto :EXISTS) ELSE (goto :CREATE)
:CREATE
Set Folder=%~dp0
Set Name=%~nx0
Echo Task does not already exist, creating it now.
SchTasks /Create /SC DAILY /TN "%Task_Name%" /TR "%Folder%%Name%" /ST %Time%
goto :eof
:EXISTS
start "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" %Site%
goto :eof
I am running GridEngine (GE 6.2u5) jobs from a command line. For example,
qsub echo "Hello"
But I get this error,
Unable to read script file because of error: error opening echo: No such file or directory
The workaround is easy, use the -b y flag. I'd like to create an SGE properties file in my home directory which will set '-y' to be the default. How do I do this?
If you want to add your option, you can edit the file "sge_request". It allows you to set the default options that will be added to any requests you will submit.
This file is situated in : SGE_ROOT/CELL_NAME/common/sge_request
For more information, check the documentation : http://gridscheduler.sourceforge.net/htmlman/htmlman5/sge_request.html
I have a PowerShell script that sends an email via SMTP. The script runs fine inside Powershell ISE, but fails in Task Scheduler. I am on Windows Server 2012. I have other Powershell scripts that I run on this server using the exact same setup, but those scripts do not send an email. The return code I see in Task Scheduler is (0xFFFD0000) and I cannot find any information on this. I have the task set to run with highest privileges and I have checked that the executionpolicy is RemoteSigned. Anybody run into this before?
Here is the command in the task:
powershell -f "c:\scripts\EmailTest.ps1"
Here is the script:
$EmailFrom = "user#domain.com"
$EmailTo = "someone#somewhere.com"
$Subject = "Email Subject"
$Body = #"
Person,
Some message here
Thanks,
User
"#
$SMTPServer = "smtp.domain.com"
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 25)
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("user#domain.com", "password");
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
Update:
I was able to resolve the issue. Apparently I had an additional line in the script that was commented out. I'm not sure why this would cause an error but once I removed that commented out line it ran fine in Task Scheduler. the comment looked like this and was just below the other $EmailTo declaration in the above script:
#$EmailTo = "someone#somewhere.com"
I found another possible issue while looking at a similar problem. I was unable to execute a PowerShell script as a Task Scheduler action, even though the script ran correctly when logged into Windows as the target user and running within PowerShell.
Task Scheduler would consistently display the 0xFFFD0000 error when I nominated the script in the task's action arguments using what I believed to be normal PowerShell quoting rules:
-ExecutionPolicy Bypass -File 'D:\full path\to\script.ps1'
PowerShell acquiesced and Task Scheduler fired off the task immediately and without issue when I changed the quotes I used from single to double:
-ExecutionPolicy Bypass -File "D:\full path\to\script.ps1"
Dropping to a command prompt and executing the full command immediately revealed the problem:
D:\>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File 'D:\full path\to\script.ps1'
Processing -File ''D:\full path\to' failed: The given path's format is not supported. Specify a valid path for the -File parameter.
Notice the strange use of two single quotes before the path and one single quote after.
The moral of the story: When feeding the full path of a script to PowerShell as a command line parameter, use double quotes!
I was receiving the same error and ultimately I had a different issue - the optional start in directory setting wasn't applied.
Essentially, I was running a .bat file - c:\tasks\process.bat
This .bat file referenced multiple ps1 scripts that were in the tasks directory and the references were just by file name (not the full directory). On the action tab in task scheduler, there is a Start in (optional) field that I had not populated. Setting it to c:\tasks allowed the references to function properly.
First of all you have to check "ExecutionPolicy" configured on your machine. to do so, check default values by following this link https://technet.microsoft.com/en-us/library/hh847748.aspx
I fixed my probleme by using this command:
On "Add arguments" option I put:
"-Executionpolicy Bypass -command "& 'T:\deleteOldMessages.ps1' "
and
I know you use the spool command when you are trying to write a report to a file in Oracle SQLplus.
What is the equivalent command in MySQL?
This is my code:
set termout off
spool ${DB_ADMIN_HOME}/data/Datareport.log # ${DB_ADMIN_HOME}/Scripts.Datavalidation/Datareportscript.sql
spool off
exit
How can I write it in MySQL?
In MySQL you need to use the commands tee & notee:
tee data.txt;
//SQL sentences...
notee;
teedata.txt == spooldata.txt
notee == spool off
For the Oracle SQLPlus spool command, there is no equivalent in the mysql command line client.
To get output from the mysql command line client saved to a file, you can have the operating system redirect the output to a file, rather than to the display.
In Unix, you use the > symbol on the command line. (It seems a bit redundant here to give an example of how to redirect output.)
date > /tmp/foo.txt
That > symbol is basically telling the shell to take what is written to the STDOUT handle and redirect that to the named file (overwriting the file if it exists) if you have privileges.
Q: is set pagesize and set linesize used in mysql when you are trying to generate a report?
A: No. Those are specific to Oracle SQLPlus. I don't know of any equivalent functionality in the mysql command line client. The mysql command line client has some powerful features when its run in interactive mode (e.g. pager and tee), but in non-interactive mode, it's an inadequate replacement for SQLPlus.
If I get what you are asking:
mysql dbname < ${DB_ADMIN_HOME}/Scripts.Datavalidation/Datareportscript.sql \
> ${DB_ADMIN_HOME}/data/Datareport.log
Use redirection.
In gdb, if I just hit return, it repeats the last command. Is there a way to configure Sun/Oracle/Solaris dbx to do likewise?
You can get that behavior by enabling "gdb mode" in dbx.
(dbx) gdb on
(dbx) step
stopped in main at line 4 in file "t.c"
4 printf("world");
(dbx)
step
stopped in main at line 5 in file "t.c"
5 printf("!");
(dbx)
step
stopped in main at line 6 in file "t.c"
6 printf("\n");
(dbx)
step
helloworld!
stopped in main at line 7 in file "t.c"
7 }
Here is the help for gdb mode from the latest dbx.
(dbx) help gdb
gdb (command)
gdb on | off
Use `gdb on' to enter the gdb command mode under which dbx will understand
and accept gdb commands. To exit the gdb command mode and return to the dbx
command mode, enter "gdb off". Please note that the dbx commands will not
be accepted while in gdb command mode and vice versa. All debugging settings
such as breakpoints are preserved across different command modes. The
following gdb commands are not supported in the current release:
- commands - define
- handle - hbreak
- interrupt - maintenance
- printf - rbreak
- return - signal
- tcatch - until
Looks like you can use the $repeatmode for this.
I got the following from the dbx-guide
Repeating Commands
You can execute any of the commands contained in the history list. Each
history command begins with an exclamation point (!):
!! Repeats the previous command. If the value of the dbx
variable $repeatmode is set to 1, then entering a carriage
return at an empty line is equivalent to executing !!. By
default, $repeatmode is set to 0.
There also seems to be another option 'gdb on' which makes dbx behave like gdb. I haven't tried either as I don't have access to dbx right now, so you can let me know if this works for you.