run specific perl script from command line - perl

Not that much experience programming, but I saw this open source code for one of those speed readers everyone is talking about and thought it would be cool to try to run it on my own computer.
The files are available here: https://github.com/pasky/speedread
I was wondering what exactly I should type into the command prompt to get the program running. I already have a perl interpreter on my computer. But I'm not sure how to get the program running. Sorry if this is a super noobish question.
I've tried
perl C:\speadread-master\speedread (and yes, it was on the C: drive)
I got the error:
Use of encoding pragma is deprecated at C:\speadread-master\speedread line 39.
'stts' is not recognized as an internal or external command, operable program of batch file.
←[31mc←[0←[K
I also tried (because it appears in the gifs on github)
~/speedread$ head -n 21 tea.txt | ./speedread -w 250
I got the error:
'~' is not recognized as an internal or external command, operable program or batch file

In addition to amon's comment, wo points out a strong dependency to Unix commands/display, you also misinterpreted the head command:
~/speedread$ is a Unix command prompt, with ~ refering to your HOME directory (USERPROFILE in Windows). You are not supposed to type it.
The actual command is:
head -n 21 tea.txt | ./speedread -w 250
Adn you have an head.exe (Windows version of the unix command head) in your git msysgit distribution (bin/head.exe).

Related

Installing files via Composer via Command Line | "'$' is not recognized as an internal or external command, operable program or batch file."

So I am attempting to install some files from Send Grid via Composer usind the CommandLine.
I am following a tutorial with the link here https://www.youtube.com/watch?v=fEobqi3N7zw
The guy in the video has no problem using Composer via the Command Line in the Windows Command Prompt, but when I input the command $ go_www, my PC whines and stamps it's feet, giving me the following line:
'$' is not recognized as an internal or external command,
operable program or batch file.
In a nutshell, why?
System Information:
Windows 10 64x
I have looked at other posts on here, to no avail, I have tried opening the Command Line too as System Administrator, but to avail. I have tried restarting the system, to no avail, I can confirmed I have composer installed into the correct directory, to no avail .
$ in a shell indicates the shell is not owned by a superuser, it is not part of the command. Try running go_www. Also, the video you linked seems to be using a bash shell, whereas you appear to be running a Windows command prompt from the error message you included in your question, which might be a problem too.
In any case, go_www is an alias the video author uses to quickly navigate to the folder of interest. Try manually navigating there using cd.

How do I execute a command using a local program in OCaml?

So the default way to execute commands in OCaml is Sys.command s where s is the command in this case, but I come across an issue when the command involves a local program. For example, if I have an executable named prog I compiled from an ocaml file, and I use Sys.command "prog {args}", I get back an error saying 'prog' is not recognized as an internal or external command, operable program or batch file. And using the command ./prog {args} doesn't seem to change anything either, since then it says '.' is not recognized as an internal or external command, operable program or batch file. Any advice?
Probably the problem is in the prog and lies outside of the OCaml, in other words, your prog is not a program, so the operating system can't run it.
Here is an example, that works perfectly for me:
$ cat > test << EOF
#!/bin/sh
echo hello
EOF
$ chmod a+x test
$ ocaml
# Sys.command "./test";;
hello
- : int = 0
So, one of the above users was right: in Windows, the batch files produced by ocamlc cannot be executed. Instead, an easy workaround is just to compile by appending the .exe tag to the file name you want to produce e.g. ocamlc -o prog.exe myfile.ml. Then, just use Sys.command "prog.exe {args}" instead.

Message " 'echo.' is not recognized as an internal or external command, operable program or batch file." when starting shell

When starting my shell, I get a message :" 'echo.' is not recognized as an internal or external command, operable program or batch file." I am not sure where it comes from. The problem is, that when I run my perl scripts as external tools in eclipse, this message is also printed in the eclipse console after the output of the scripts. How can I get rid of it?
Remove the . at the end of echo. command used in the perl script.
To locate the perl script involved in a directory and all sub directories, use:
grep -irH "echo[.]" .
This other command-line below automatically update all perl scripts found in current directory and sub directories; it replaces any echo. encountered with echo
WARNING: backup the directory before running the command-line below:
find . -type f -print0 | xargs -0 -I xxxx sed -i 's/echo[.]/echo/g' xxxx
Barbara Jensen provided the best answer in a comment (quoted below)
Echo. in Windows CMD should print a blank line, but in some situations, it returns the "is not recognized as an internal or external command..." error. I suspect it's cmdextensions or similar.
Barbara says "echo/" replaces it and this worked perfectly for me. Thanks B.
echo. is supposed to display a blank line; it is not invalid Windows command. I have used this in batch files for at least 15y and it went bad for me very recently. Interestingly for me, its working sometimes (the windows that I've set up for compiling) and not others (fresh ones). If I change the echo. to echo/ in my batch files, they work again. – Barbara Jensen Feb 14 at 13:55
Since this is the top search hit when searching for the error message: one can also end up with this intermittent error message when the current directory contains a file named echo, even if it's empty. It's easy to diagnose this possibility: move to another directory and check if echo. works. It should normally print an empty line in cmd, where echo is a built-in command. If echo. works in other directories: rename or remove the file called echo.
Figure out which one of your shell startup files contains the misspelling and remove it (the misspelling, not the file).

redirecting echo with undefined variable

I'm running a script in solaris 11 with different results depending of the shell used.
The script has an echo redirecting to a file given by an environment value:
echo "STARTING EXEC" >> $FILE
ps. EXEC is just the message the script show, it's not using exec command.
If I execute the script without the variable FILE defined (using /usr/bin/ksh):
./start.sh[10]: : cannot open
and the script continue the execution.
The flags for ksh are:
echo $-
imsuBGEl
But if I change to /usr/xpg4/bin/sh, the script show me the echo in stdout and there is no error shown.
The flags for xpg4 sh are:
echo $-
imsu
I tried to change the flags with set +- (I can't remove El flags, but BG are removed ok), but can't get the same behavior.
Is there anything I can do to get the same result using ksh without cannot open error?
/usr/bin/ksh --version
version sh (AT&T Research) 93u 2011-02-08
I'll want the script keep going, showing the message in stdout, instead of showing the error just like it does now.
Like shellter said in the comments, the good thing to do is to check if the FILE variable is defined before doing anything. This is a script migration from an HPUX to a SOLARIS environment, and client think they must have the same result as before (we unset FILE variable before execution to test it).
You are likely running Solaris 11, not Solaris 64.
Should you want to have your scripts to work under Solaris 11 without having to search everywhere the bogus redirections, you can simply replace all shebangs (first line) by #!/usr/xpg4/bin/sh.
The final solution we are going to take is to install the ksh88 package and use it like default shell (/usr/sunos/bin/ksh). This shell have the same behavior the client had before, and we can let the scripts with no modifications.
The ksh used in solaris 11 is the 93 (http://docs.oracle.com/cd/E23824_01/html/E24456/userenv-1.html#shell-1)
Thanks #jlliagre and #shellter for your help.

Getting error in command line in Tesseract in Windows

I am following this documentation-https://code.google.com/p/tesseract-ocr/wiki/TrainingTesseract3
I am trying to make a font for my language using this command-
training/ text2image --text=training_text.txt --outputbase=bn.Boishakhi.exp1 --font=Boishakhi --fonts_dir=C:\
I am getting this error
"Training is not recognized as external or internal command", on windows xp sp3 command line.
I am also having another problem.I ran tesseract successfully in windows xp sp3(English default traindata) but I cannot run it from command line to generate output in Windows 7 and 8.1. The commands I used are as follows:
cd C:\
cd Program Files
cd Tesseract-OCR
tesseract C:\Document.tif output -l eng
Please help.
I tried to change /(slash) to \ (backslash) but now the new error is "Cannot find the path specified"
As far as running in windows 7 or 8.1 is concerned, the error is "cannot create output file output.txt"
The first message means that the executable training was not found on the path. If the required executable was text2image then the space should be removed and the correct directory-separator used. \ separates directories in Windows; / introduces switches.
So training\text2image... should cure the problem, provided text2image is an executable found in training which is a subdirectory of whatever is the current directory, or you could use an absolute path, "C:\wherever\you have installed\tessteract\training\text2image" - and "note the quotes" that are required if the path to the name includes spaces (optional otherwise.)
As for your second question, you have unaccountably provided no information about any error messages you received, or how the system responded, so any response will be a guess. It may have something to do with the default protected status of the root directory C:\ and it may not. Please edit the question to include the error message or run report.