Mailinglist Archive: opensuse (818 mails)

< Previous Next >
Re: [opensuse] different types of shell scripts
  • From: Ken Schneider - openSUSE <suse-list3@xxxxxxxxxxxxx>
  • Date: Thu, 22 Sep 2011 09:24:41 -0400
  • Message-id: <4E7B3719.2@bout-tyme.net>
On 09/22/2011 04:11 AM, George OLson pecked at the keyboard and wrote:
I downloaded a program that I needed off the internet and the
installation program was a script file with the extension .sh. The
instructions from the developer said to run the script on a command line
by typing the command:

./<filename>

I thought (mistakenly) that I could run any shell script by typing the
command . <filename> (with a space between the dot and the filename). So
I tried to run it that way, and I got the error "cannot execute binary
file".

However, when I followed the developer's instructions and typed in
./<filename>, the script executed perfectly and installed the program.

So my question is, what is the difference between running a script file
with the command

<dot><space><filename>, for example "#> . myscript.sh"

Used to source the contents of the file, typically used when changes are made to your .bashrc file (or other file containing environment variables) so that you do not need to log out/in to read the changes into your current login session.


and running it with

<dot><slash><filename>, for example "#> ./myscript.sh"?

Used to execute the shell script, better to use "sh myscript.sh" (without the quotes).


G


--
Ken Schneider
SuSe since Version 5.2, June 1998
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
References