Re: [opensuse] Need some help with a script
- From: "Brian K. White" <brian@xxxxxxxxx>
- Date: Thu, 5 Feb 2009 21:32:53 -0500
----- Original Message ----- From: "Randall R Schulz" <rschulz@xxxxxxxxx>
To: <opensuse@xxxxxxxxxxxx>
Sent: Thursday, February 05, 2009 5:46 PM
Subject: Re: [opensuse] Need some help with a script
On Thursday February 5 2009, nordi wrote:Rikard Johnels wrote:
>> while read x; do
>
> Cant get this to work at all.
> It starts, but just sits there doing nothing.
OK, should have added that you need to run "cat the_file |
./my_script", just as with my sed program. The "read x" reads from
stdin, and will wait forever if it has to.
While that works, we really shouldn't be encouraging such roundabout
ways of redirecting a program's standard input. That is what the
shells' less-than (<) operators are for. For the example above, the
canonical way to invoke it is this:
% my_script <the_file
(I cannot refrain from remarking that it's silly not to put the current
working directory in your PATH variable unless you don't trust the
other users of your system.)
Don't teach bad habits.
It's always bad to have . in path.
You are just begging to get raped.
It's not a matter of trusting other users on the system.
It's maybe possibly arguable for unpriviledged users but really even that is dumb.
*anything* might be written to your current dir any time by any process you run.
The extra time I spend typing "./" does not compare to even one time of spinning my wheels wondering why something is behaving so bizarre, having forgotten to check if maybe there is something in $PWD screwing up basic assumptions that should be safe. That are _supposed_ to be safe.
The alternative is having to specify the full explicit path to every binary, and shell built-in, you ever run, not just by hand but in every script and even compiled into many binaries.
It's one of those things that you as the owner of your box may do, but it's really irresponsible to ever even suggest to anyone else they do so.
Anyone working with computers should have habits based on being explicit and unambiguous anyways.
You should _want_ to be typing "./myscript" instead of "myscript" when you explicitly want to run some transient local temp file. If it's not a transient temp file and will be used more than once, then you can move it into ~/bin which can be in PATH and have your convenience just fine. There is absolutely no excuse for . in PATH.
--
Brian K. White brian@xxxxxxxxx http://profile.to/KEYofR
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx Linux SCO FreeBSD #callahans Satriani Filk!
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
- Follow-Ups:
- Re: [opensuse] Need some help with a script
- From: Randall R Schulz
- Re: [opensuse] Need some help with a script
- References:
- [opensuse] Need some help with a script
- From: Rikard Johnels
- Re: [opensuse] Need some help with a script
- From: Rikard Johnels
- Re: [opensuse] Need some help with a script
- From: nordi
- Re: [opensuse] Need some help with a script
- From: Randall R Schulz
- [opensuse] Need some help with a script
- Prev by Date: Re: [opensuse] Google Earth v5.0 Crashes System
- Next by Date: Re: [opensuse] Reply to mailing lists
- Previous by thread: Re: [opensuse] Need some help with a script
- Next by thread: Re: [opensuse] Need some help with a script
- Index(es):
Relevant Pages
|