Re: [opensuse] different types of shell scripts



Le 22/09/2011 10:11, George OLson a écrit :

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

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

.........................
"help ."

.: . filename [arguments]
Execute commands from a file in the current shell.

Read and execute commands from FILENAME in the current shell. The
entries in $PATH are used to find the directory containing FILENAME.
If any ARGUMENTS are supplied, they become the positional parameters
when FILENAME is executed.

Exit Status:
Returns the status of the last command executed in FILENAME; fails if
FILENAME cannot be read.

so . filename runs the script listed in the file filename
..........................

usually, "." is the current folder, so ./script runs the script in the current folder, just in case you have a widely executable of the same name

for example, test is a shel command, so:

dd@linux-0i5h:~> test
jdd@linux-0i5h:~> ./test
bash: ./test: Aucun fichier ou dossier de ce type

with ./test I could run my own script named test (just a example, it's not a good idea to have several commands with different result)

jdd




--
http://www.dodin.net
http://pizzanetti.fr
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx



Relevant Pages

  • Re: Discovering variable types...
    ... >I considered adding an Overlapped flag to my open procedures but bailed on the ... >memory allocations for your variables from disk as well. ... VWIN32_DIOC_DOS_INT13 Performs Interrupt 13h commands ... FOpenWrite(FH, 'FileName') ...
    (comp.lang.pascal.delphi.misc)
  • Re: Shell Script
    ... Within the script, it will change the directory to /opt, and then exit. ... THIS HAS NO EFFECT ON THE SHELL YOU RUN THIS COMMAND IN. ... Read and execute commands from FILENAME and return. ...
    (linux.redhat)
  • Re: Renaming files with substitution in names
    ... very same commands you are executing (and has the added benefit that it's ... you prefer) commands needed to perform the renaming, but does not execute ... let's revisit the script with comments. ... # contains the new filename. ...
    (comp.unix.shell)
  • Re: SET ALTERNATE question
    ... only the data that I designate and no termination character. ... commands, I get the same results but this file is terminated with a ... "Usage: rmctrlz filename" ...
    (comp.lang.clipper)
  • Re: copy or move files "right click" option?
    ... At the beginning of your script (since you did not post any code I can't ... tell you exactly where it goes) put these commands (the lines that start ... ' put code here to display an error message or you can just quit. ... ' This command assigns the first argument to the variable: filename ...
    (microsoft.public.scripting.vbscript)