3

I have a run.sh in a directory in ubuntu linux 12.04 LTS. I've been changing the Path variable so that it can "see" binaries elsewhere in the directory structure. But I am still getting a command not found even if I specify the full path. I have only basic working knowledge of linux. What is going on? Why can't it see run.sh?

memsql@memsql-virtual-machine:~/voltdb/doc/tutorials/helloworld$ sudo /home/memsql/voltdb/doc/tutorials/helloworld/run.sh
sudo: /home/memsql/voltdb/doc/tutorials/helloworld/run.sh: command not found
memsql@memsql-virtual-machine:~/voltdb/doc/tutorials/helloworld$ ls
Client.class  deployment.xml  Insert.class  log     run.sh        Select.java
Client.java   helloworld.sql  Insert.java   README  Select.class  statement-plans
memsql@memsql-virtual-machine:~/voltdb/doc/tutorials/helloworld$ pwd
/home/memsql/voltdb/doc/tutorials/helloworld
3
  • Perhaps there is a leading or trailing space in the file name. Can you get to it using tab completion? Could you post the output of printf "<%s>\n" /home/memsql/voltdb/doc/tutorials/helloworld/*run*?
    – terdon
    Commented Oct 10, 2013 at 18:11
  • Is run.sh executable?
    – Bernhard
    Commented Oct 10, 2013 at 18:14
  • try sudo ./home/memsql/voltdb/doc/tutorials/helloworld/run.sh or sudo sh /home/memsql/voltdb/doc/tutorials/helloworld/run.sh. Either should work as long as you have made run.sh executable (chmod +x run.sh)
    – Jeight
    Commented Oct 10, 2013 at 18:16

2 Answers 2

3

You should make it executable with chmod a+x run.sh and then try again.

This will make the file executable.

0

It's most likely what someone else mentioned in that the file isn't executable. Sometimes, it's something else.

If the shebang (#!/bin/sh or equivalent) is incorrect, I've seen the shell report file not found or command not found even though it is there an executable. When I saw it it was a case of a perl script that had #!/usr/local/bin/perl when perl was in /usr/bin.

Just figured I'd throw in this other potential cause.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .