Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

running a script

Status
Not open for further replies.

random260

Programmer
Mar 11, 2002
116
US
I'm trying to install a printer on a linux server (and I'm pretty linux dumb) and the directions say to "Run the 'setup.sh' script on the CDROM to launch the installation program, if the installer didn't start automatically upon insertion of the CDROM in your drive."

Well that's all fine and dandy BUT how do I do that? I have copied all of the files to a folder on the server but when I attempt exec setup.sh or exec setup it just says no such file (I am in the folder where the setup.sh file is located). I am obviously missing something pretty basic and stupid here...
 
A queer thing about *nix is that they only look for apps located under your $PATH variable. It doesn't care if you are in the folder where the file is located like in DOS/Windows. If you need to execute a file in the current directory, you need to append a ./ to the file name.

If a file is to be executed, it will nedd to have its execute bit set. This is usually done by chmod +x [file_name]. Files on a CDROM usually do not have the execute bit set. For your to be able to execute a file on a CDROM without the execute bit set, you will need to launch a shell to execute it manually. i.e. bash setup.sh


--== Anything can go wrong. It's just a matter of how far wrong it will go till people think its right. ==--
 
If you're in bash shell, you do not need the execute mask, or the "./" before the script; you can just execute it like :

sh setup.sh

--------------------------------------------------
Free Database Connection Pooling Software
 
sedj: if the script has as first line

[tt]#!/bin/bash[/tt]

executing the script as [tt]sh script.sh[/tt] will open a new sh shell and then a new bash shell, using more resources than needed.

Cheers.
 
Indeed it will - but it does mean you don't have to bother with chmod'ing - and how much resource does a shell really take ?!

--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top