Command line commands not executing? - cmd

Hello all well I have no idea why no commands will execute in my CMD.
i tried executing ping http://google.com and it tells me it's not recognized?
thanks.

Your path statement has changed.
Type path and see what it shows in a fresh command window

Related

How do I get the `run` command working on Windows 11?

I wanted to try testing Raku code on Windows. I managed to get Windows 11 set up on VirtualBox and the Raku binary installed and I can execute scripts.
However, I cannot seem to get the simplest run command to do anything without returning an error:
run('ls');
results in:
The spawned command 'ls' exited unsuccessfully (exit code: 1, signal: 0)
in block <unit> at .\test.txt line 5
I also tried with dir command, but had the same problem.
There is no ls program on Windows by default, and dir is not an executable that can be run, but rather a Windows command shell built-in. You could try using shell instead of run, or instead try something like:
run 'cmd.exe', '/c', 'dir'

Running gmt.script

I try to run a gmt-script and get the message:
bash-3.2$ plot_scenario.gmt
bash: plot_scenario.gmt: command not found
Does anyone know what could fix the problem?
I got a script from my supervisor, and it worked just fine on the uni Linux pc.
I have a Mac OS.
When you type text in shell, it tries to look for available commands. Here bash doesn't find any command like plot_scenario.gmt and outputs command not found.
The proper way to execute a file is ./filename where . refers to current directory. But you need to give execution permission to file you want to run. So, following commands may help you:
chmod +x <filename>
./<filename>
Note that make sure your pwd is where you're file is located. Another way to run or execute file is calling the shell:
bash /path/to/file

AppleOS Terminal to MS Command Prompt translation

How do I translate the Terminal command
pdf2txt.py -o filename.txt -t tag filename.pdf
for the Command Prompt on a Windows machine?
The commands are arguments passed to the pdf2txt.py script and they depend on the code inside the file, not on any terminal/command prompt constraints. So, the code remains exactly the same

Simple Bash Script says Command not found

I'm trying to run an extremely simple bash script that runs some commands on the shell. For now, all it is composed of is:
#!/bin/bash
eos
Where "eos" is a perfectly legit command that runs perfectly fine on the server I'm using if I run it manually on the same shell.
However, when I chmod +x and execute this script, I get the error:
./cp.sh: line 21: eos: command not found
Does anyone have any idea why it won't submit these commands?
Thanks in advance!
What user is running the script? I suspect an environment or pwd issue, although permissions are a possibility.
Try using the full path to eos or setup the necessary environment in the script.
In unix shell "command not found" error comes when the directory at which command is located is not in PATH (an env variable) which is searched to locate the command.
The solution to this is either of any of the 2 approaches mentioned below
a) change PATH and export PATH variable either in shell startup files or user profiles
export PATH=$PATH:/eos-command-directory-location/
b) run the eos command in shell script you have developed with full path

Javac command returns "Invalid flag" when run from SHell script

So I have a .sh script (in Ubuntu):
#!/bin/bash
javac betz2.java
When I run it, it says:
Invalid flag: betz2.java
WHen run in terminal, it works just fine? why?
javac betz2.java
Maybe javac is not in the Bash path, but your command line is using a different shell that does have it. In your command line type echo $SHELL and you'll see if it is bash or not.
Did you edit your file in Windows and then opened it in a different operating system? (Linux). Carriage returns might be causing you trouble, just create a new file and paste your command.

Resources