Re: [SLUG] Difficulty level for a beginner?

From: Paul M Foster (paulf@quillandmouse.com)
Date: Sat Mar 12 2005 - 10:49:22 EST


On Sat, Mar 12, 2005 at 06:00:57AM -0500, Kwan Lowe wrote:

> Paul M Foster wrote:
>
> >I'd make a couple of comments. First setting $CAT et all to fixed values
> >is okay, but has a liability. If you're ever on a different machine with
> >a different distro, you may find things moved (well, maybe not with
> >these particular commands). Better to do something like:
> >
> >CAT=`which cat`
> >
> >The which command finds where something is on your system, and the
> >backticks (`) allow its execution.
> >
> >Personally, I never do this. Rather than setting a $CAT variable, I just
> >use cat, like:
> >
> >cat /proc/omnibook/ac
> >
> >If a user is running this and the paths to these executables aren't in
> >their personal path, they have a bigger problems.
> >
> >Anyway, you're doing great. Just keep at it. (BTW, you can do the above
> >script actions in C as well, though it's _far_ more complicated.)
> >
>
> Hey Paul:
> I'd disagree somewhat with not setting variables explicitly. For all
> but my most rudimentary scripts, I manually set a variable to the full
> path of the executable. It allows the script to run when the executable
> isn't in the path, and can be arguably safer against some malicious path
> manipulation.

I'd agree if I'd ever been in a situation where "cat" and the like
weren't in the path. If /bin's not in your path, shouldn't it be?

Paul
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:36:26 EDT