Problem running a script

Deadjasper

2[H]4U
Joined
Oct 28, 2001
Messages
2,346
I have a script on the Desktop named QuantaFanSpeed.sh I run the command to make it an executable - chmod +x QuantaFanSpeed.sh from a command prompt and I get this -

Screenshot from 2022-01-13 08-37-04.png


The file is clearly on the desktop so what am I missing? :confused:

TIA

OK, so I moved the script to the home directory and now I can see it when I do a ls -a but I get "Command Not Found". :confused:
 
Last edited:

toast0

2[H]4U
Joined
Jan 26, 2010
Messages
2,330
Ok so first things first, unless the colors are important, you want to copy and paste the text (in a code block) rather than post a screenshot. Text is easier to use.

For the future, you wouldn't have needed sudo to chmod something in your home directory, but it's fine.

Usually command not found shows the command it's trying to run. If it's the script, it's common for your PATH variable to not include the current directory; in which case you need to try to run ./QuantaFanSpeed.sh. But the issue could be the path to the interpretter (at the top of the script) or a program it wants to run, which you may need to install (typically through your package manager)
 

Deadjasper

2[H]4U
Joined
Oct 28, 2001
Messages
2,346
This is the script -

#!/bin/sh
ipmitool -I lanplus -H 192.168.10.233 -U admin -P admin raw 0x30 0x39 0x01 0x0 0x0 0x16
ipmitool -I lanplus -H 192.168.10.233 -U admin -P admin raw 0x30 0x39 0x01 0x0 0x1 0x16
ipmitool -I lanplus -H 192.168.10.233 -U admin -P admin raw 0x30 0x39 0x01 0x0 0x2 0x16
ipmitool -I lanplus -H 192.168.10.233 -U admin -P admin raw 0x30 0x39 0x01 0x0 0x3 0x16
 

Nobu

[H]F Junkie
Joined
Jun 7, 2007
Messages
8,977
cd to your desktop folder (`cd ~/Desktop`, usually).

Edit: '~' is short for "/home/[current_username]" in most shells, and most distros put the desktop contents in it's own folder instead of your home folder, usually it's named "Desktop".
 

Deadjasper

2[H]4U
Joined
Oct 28, 2001
Messages
2,346
sparkey@sparkey-desktop:~/Desktop$ ./QuantaFanSpeed
bash: ./QuantaFanSpeed: No such file or directory
sparkey@sparkey-desktop:~/Desktop$

ls -a clearly shows the script as being there.
 

Nobu

[H]F Junkie
Joined
Jun 7, 2007
Messages
8,977
Forgot the ".sh"?

Try typing "bash Qua" then hit the "tab" key, it should autocomplete if the file exists. It wont autocomplete if you try to execute the script directly from within a bash shell if it's not executable, so we're using the bash command just in case.
 

Nobu

[H]F Junkie
Joined
Jun 7, 2007
Messages
8,977
It should have run, yes. You can check to see if it did what you wanted, or run a packet sniffer on that network interface to watch for those packets when you run the script.
 

Deadjasper

2[H]4U
Joined
Oct 28, 2001
Messages
2,346
Yep, just fired her up and it did run. Mucho gracias. so I type bash QuantaFanSpeed.sh to run it? I was typing ./QuantaFanSpeed.sh.
 
  • Like
Reactions: Nobu
like this

Nobu

[H]F Junkie
Joined
Jun 7, 2007
Messages
8,977
Either should work if it's executable and in your $PATH. Just make sure it's the full path if you aren't in that directory. "." means current directory, so if it's not you'll have to do "/home/[username]/Desktop/QuantaFanSpeed.sh"

iirc, if the file is executable and includes #!/bin/bash as the first line of the file, you can just click the file on your desktop and it'll run (although there probably will be no visual feedback).
 
Top