0

I moved netbeans-7.4-linux.sh in the following directory /media/hosam/I/Linux, before installing Ubuntu. What I type:

hosam@HOSAM:~$ cd '/media/hosam/I/Linux/'
hosam@HOSAM:/media/hosam/I/Linux$ sudo chmod +x netbeans-7.4-linux.sh
[sudo] password for hosam: 
hosam@HOSAM:/media/hosam/I/Linux$ sudo ./netbeans-7.4-linux.sh

What I get

sudo: ./netbeans-7.4-linux.sh: command not found

When I moved it to /home it worked well

HMS8
  • 129
  • 2
  • 3
  • 13

2 Answers2

2

./ means "this directory". If you've moved it somewhere else you either need to change directory with cd:

cd /media/hosam/I/Linux
./netbeans-7.4-linux.sh

Or give the full path when calling it:

/media/hosam/I/Linuxnetbeans-7.4-linux.sh

You'll also need to make sure it has been marked executable. You can do this through the right click properties menu in Nautilus or by running

chmod +x /media/hosam/I/Linuxnetbeans-7.4-linux.sh

If that still doesn't work, it seems likely that the filesystem it's sitting on is probably mounted in such a way that prevents files being directly executed. That leaves you with a few options:

  • Call sh /media/hosam/I/Linuxnetbeans-7.4-linux.sh explicitly (this doesn't need execute permissions)
  • Remount the /media/hosam/ filesystem as executable. If it's NTFS, see this
  • Or move the file to a filesystem that will support it being chmod +x
Oli
  • 293,335
0

You have to move the script file into the / directory, so that the script will execute or otherwise it won't execute by default.

It needs some workaround to execute a script which was actually present inside an ntfs partition.Just try to remount the ntfs partition by following this answer, so that you can be able to chmod the files inside ntfs partition.

sudo mkdir /media/foo
sudo mount -t ntfs -o rw,auto,user,fmask=0022,dmask=0000 /dev/whatever /media/foo
sudo chmod +x /path/netbeans-7.4-linux.sh
sh /path/netbeans-7.4-linux.sh
Avinash Raj
  • 78,556