unable to execute unix script using . script_name - unix

I am unable to execute following command in unix as
e.g. ->
export ENVFILE=$PARENT_DIR/../env/.tpms.evr
while i try to execute . "${ENVFILE}" it shows me error as bash: 39910-: command not found
can anybody let me know about how to fix this.

You most probably have a line in .tpms.evr script which bash tries to execute as a command called "39910-"
Please share this .tpms.evr script or just that line containing "39910-"

Related

R system call returns error

I am trying to execute a python script from within R, with the following command:
system("python ~/speedtest-cli/speedtest-cli --simple")
The error I get is:
python: can't open file '/home/speedtest-cli/speedtest-cli': [Errno 2] No such file or directory
The same command works just fine on the terminal. Am I using the command wrong? Any help is appreciated.

Executing R script within R 3.3.1 installed on windows

Sorry for a basic question. I'm trying run a R script called cuffdiff_gtf_attributes (please find it at enter link description here in R 3.3.1 installed on the Windows 7. The script is started with the below line:
#!/usr/bin/env Rscript
When I type cuffdiff_gtf_attributes in R, it says Error: object 'cuffdiff_gtf_attributes' not found. Also, I tried Rscript cuffdiff_gtf_attributes that returned me: Error: unexpected symbol in "Rscript cuffdiff_gtf_attributes".
Moreover, I tried source('cuffdiff_gtf_attributes.R')that seems to work and returned the usage of the script as bellow
Error:
usage: cuffdiff_gtf_attributes --input=<inputGTF> [--output=outputGTF] | --help
But, when I add the arguments as source('cuffdiff_gtf_attributes.R') --input=file.gtf, it says that: Error: object 'file.gtf' not found. I also tried this command as source('cuffdiff_gtf_attributes.R') --input file.gtf, it says that Error: unexpected symbol in "source('cuffdiff_gtf_attributes.R') --input file.gtf"
Sorry, I couldn't post a sample GTF file, you can find a short sample of it at enter link description here
Everything is the current path. Could you please help me out to execute the script?
Thanks in advance
This is a script file. You should run using Rscript instead for Rgui.exe. From a command prompt, navigate to the directory where file.gtf is and run:
"%Programfiles%\R\R-3.3.3\bin\Rscript" cuffdiff_gtf_attributes.R --input=file.gtf

Unable to locate jar file in DB2 Command prompt

I am trying to create a User Defined Functions in IBM data studio, I am following the steps at this Link.
I did not have any problem until the step where I have to Register the jar file with DB2 by entering:
db2 "CALL sqlj.install_jar('C:\Program Files\IBM\SQLLIB\java\jdk
\bin\udftest.jar','UDFTESTJAR')"
Into DB2 Command Prompt. However it shows the following error:
SQL20200N The install or replace of "BELSIZE .UDFTESTJAR" failed as
"C:\Program Files\IBM\SQLLIB\java\jdk\bin\udftest.j" could not be
located. SQLSTATE=46001
I have check through the location of udftest.jar, I am sure that the location path was correct. May I know what is wrong with me command line? Thanks in advance!
After looking true the website link again, I have forgotten to add file: at the path.
db2 "CALL sqlj.install_jar('file:C:\Program Files\IBM\SQLLIB\java\jdk
\bin\udftest.jar','UDFTESTJAR')"

Convert DOC to PDF using unoconv via Symfony Component

I'm trying to convert word documents to PDF, via the commandline using unoconv via PHP.
I'm using the Symfony Process Component to run the command via the command line.
public function run()
{
$cmd = 'unoconv --listener & unoconv ' . $this->path;
//Tested this to check for permissions and this worked.
//$cmd = 'touch /vagrant/public/testfile.pdf';
$process = new Process($cmd);
$process->run();
return $process->getOutput();
}
This yields no output, and doesn't convert the file. However if I echo the $cmd and paste it into the CLI it converts the file as expected and logs output as it goes.
Any ideas what could be the problem?
Edit:
I've since tried: calling mustRun() & start() methods on the symfony class.
mustRun() gives the following error:
"The command '//command//' failed. Exit Code: 251(Unknown error) Output: ================ Error Output: ================
After adding the log code as suggested by Diego Ferri, I get Error: Unable to connect or start own listener. Aborting. in the log file; but I can't find much online that's helpful for that.
Please read this section but also check the troubleshooting section.
It is possible that the shell is missing some important environment variables for unoconv/LibreOffice to work properly (PATH, HOME, ...). And it is recommended you call the LibreOffice python binary with unoconv instead of leaving it up to unoconv to determine the location of LibreOffice and python.

Error while running a .sh script via QProcess

I have written a QT GUI program where pressing a button will execute a .sh script. The contents of the script is-
echo -e 'attach database 'testdatabase.db' as 'aj';\n.separator ","\n.import ora_exported.csv qt_ora_exported' | sqlite3 testdatabase.db
basically the script will import a .csv to an sqlite database. And when the script file (script.sh) is run manually from linux terminal ($./script.sh) it successfully imports the .csv file into the database table.
But, when I call the script from my QT program
void MainWindow::on_importButton_clicked()
{
QProcess process;
process.startDetached("/bin/sh",QStringList()<<"/home/aj/script.sh");
}
it compiles successfully but gives an error message in console when the button is pressed at runtime.
Error: near line 1: near "-": syntax error
Error: cannot open "ora_exported.csv"
what could be causing this ???
EDITED
I have changed my .sh script now to--
echo -e 'attach database 'testdatabase.db' as 'aj';\n.separator ","\n.import /home/aj/ora_exported.csv qt_ora_exported' | sqlite3 testdatabase.db
Thus providing the path to my ora_exported.csv. As a result the runtime error [Error: cannot open "ora_exported.csv"] has gone but the other message [Error: near line 1: near "-": syntax error] is still coming.
Same as was observed in previous case, using ./script.sh is successfully importing data to sqlite3 db table file but QProcess is unable to.
echo is a built in command of a shell that may behave differently.
E.g. take this test script: echotest.sh
echo -e "123"
Now we can compare different results:
$ bash echotest.sh
123
$ zsh echotest.sh
123
$ dash echotest.sh
-e 123
You are probably on some Ubuntu-like OS, where /bin/sh redirects to dash. That would explain the error around "-". So if you are using echo, set you shell specificially or ensure that your script works on all common shells.
Additionally, you are messing up your quotations
echo -e 'attach database 'testdatabase.db' as 'aj';\n.separator ","\n.import /home/aj/ora_exported.csv qt_ora_exported'
results in (no quotations in the first line)
attach database testdatabase.db as aj;
.separator ","
.import /home/aj/ora_exported.csv qt_ora_exported
but you pobably want
echo -e "attach database 'testdatabase.db' as 'aj';\n.separator ','\n.import /home/aj/ora_exported.csv qt_ora_exported"
It looks strange that you are using external script to update database!
why you don't pass "ora_exported.csv" file name as a script argument? This would help solve the problem.
I was talking (typing) about this solution:
void MainWindow::on_importButton_clicked()
{
QProcess::startDetached("/bin/sh",
QStringList()<<"/home/aj/script.sh",
"<location of: 'ora_exported.csv' file>");
}

Resources