* Re: preventing slackware services from auto starting
` Steve Holmes
@ ` Adam Myrow
` Joseph C. Lininger
` Ralph W. Reid
2 siblings, 0 replies; 9+ messages in thread
From: Adam Myrow @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
On Mon, 5 Sep 2005, Steve Holmes wrote:
> Why is that first period necessary? I've seen that from time to time in
> Slackware startup scripts but I never knew why and when I've added
> commands to my own startup scripts, I usually leave it out with no known
> effects.
I don't know if it's strictly necessary, but it does change the behavior.
Normally, if you execute a shell script by typing its name, it will run in
a subshell, which will be determined by the "#!" line at the top of the
script. For example, if the top line says "#!/bin/sh," it runs in
/bin/sh, which is normally a symbolic link to Bash under Linux.
If, on the other hand, you invoke the script with a period by itself at
the beginning of the line, the script runs in the current shell, and the
"#!" line is treated as a comment and ignored. This is how .profile is
ran at login. This has both advantages and disadvantages. The obvious
disadvantage is that if the script is intended for Perl, or Tcsh, it will
bomb out with this method since the current shell tries to interpret it.
The big advantage is that any environment variables you set will remain
after the script quits. That's why export commands in your .profile will
work, but if you try them in another script, and invoke it without the
period, they will vanish once the script exits. Exported variables are
available to child shells, but not parent shells. This makes it very
difficult to pass variables from a script back to the parent shell, unless
you source it so that it runs in the current shell. Hope this explains it
clearly. My suspicion is that Slackware is sourcing the other startup
scripts in order to keep the number of processes down at boot time.
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: preventing slackware services from auto starting
` Steve Holmes
` Adam Myrow
@ ` Joseph C. Lininger
` Ralph W. Reid
2 siblings, 0 replies; 9+ messages in thread
From: Joseph C. Lininger @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Whether or not you need it has to do with whether or not the script has
execute permition. If it does, then you won't need that. The period is
just another way of saying the word "source" at the beginning of a line.
Thus:
. /etc/rc.d/rc.pcmcia stop
Is the same as:
source /etc/rc.d/rc.pcmcia stop
Bash will run these whether or not the script has the execute permition
provided you have used "." or "source".
- --
It's not one damn thing after another, it's the same damn thing over and
over. (History repeats itself)
Joseph C. Lininger
jbahm@pcdesk.net
Verification: 5eab38a77ac40416e075be8f50607ff7
And so it came to pass that on Mon, 5 Sep 2005, Steve Holmes said
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
>
> On Sat, Sep 03, 2005 at 07:58:24PM -0600, Joseph C. Lininger wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> To turn off the pcmcia service in slackware, try this:
>>
>> chmod a-x /etc/rc.d/rc.pcmcia
>>
>> To kill it without rebooting, do this:
>>
>> . /etc/rc.d/rc.pcmcia stop
>>
>> Note the period at the beginning, it is required.
>
> Why is that first period necessary? I've seen that from time to time
in
> Slackware startup scripts but I never knew why and when I've added
> commands to my own startup scripts, I usually leave it out with no
known
> effects.
>
> - --
> HolmesGrown Solutions
> The best solutions for the best price!
> http://ld.net/?holmesgrown
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.7 (GNU/Linux)
>
> iD8DBQFDHDJ9WSjv55S0LfERAxyFAKCZX1HkxNPcfpAOk/RcPsyyk8dj8QCbBqZF
> YctH/MsWZ9s6ci8Yny++xCk=
> =aR5D
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)
iD8DBQFDHKGaJ6dqn0mqPbARAqbwAJ0TSdft1AShndsiNMi76dy5vYnJXQCgmon0
1ayWaKPYlvrQ8HJfKr7zFH8=
=ZWkB
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: preventing slackware services from auto starting
` Steve Holmes
` Adam Myrow
` Joseph C. Lininger
@ ` Ralph W. Reid
` Steve Holmes
2 siblings, 1 reply; 9+ messages in thread
From: Ralph W. Reid @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
On Mon, Sep 05, 2005 at 04:56:48AM -0700, Steve Holmes wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> ...
> Why is that first period necessary? I've seen that from time to time in
> Slackware startup scripts but I never knew why and when I've added
> commands to my own startup scripts, I usually leave it out with no known
> effects.
>
The leading period forces a command or script to run in the current
shell instead of in a subshell. This is sometimes necessary,
especially where user defined functions or environment variables are
to be defined and used in the current shell as well as all of the
subshells run from within the current shell. For example, running the
following command from the console:
/etc/bashrc
might not allow any variables or functions to be usable in the current
console, while the command:
. /etc/bashrc
will allow any changes in the /etc/bashrc file to be effective
immediately.
See the 'bash' man page for more details.
HTH, and have a _great_ day.
--
Ralph. N6BNO. Wisdom comes from central processing, not from I/O.
rreid@sunset.net http://personalweb.sunset.net/~rreid
...passing through The City of Internet at the speed of light!
PARABOLA = x ^ 2
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: preventing slackware services from auto starting
` Ralph W. Reid
@ ` Steve Holmes
0 siblings, 0 replies; 9+ messages in thread
From: Steve Holmes @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
Thanks to all of you; this fact is interesting to me and I really had no
idea. I didn't have a thourough understanding of sourcing either so
this all makes sense now. It's all good:).
- --
HolmesGrown Solutions
The best solutions for the best price!
http://ld.net/?holmesgrown
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.7 (GNU/Linux)
iD8DBQFDHvUxWSjv55S0LfERA0VgAKCSyw/qrGn5qwVMMo9R6sSTtE2NOwCg4O6I
qXI5Uey1RvPCrpgEqDkhQX4=
=3mDA
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 9+ messages in thread