bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash script file naming problem?


From: Chris F.A. Johnson
Subject: Re: Bash script file naming problem?
Date: Sat, 25 Jul 2009 14:53:32 -0400 (EDT)
User-agent: Alpine 2.00 (LMD 1167 2008-08-23)

On Sat, 25 Jul 2009, Ken Irving wrote:

> On Fri, Jul 24, 2009 at 07:36:31PM -0700, michael rice wrote:
> > Is there a problem with naming a bash script file "script"? I'm using 
> > Fedora 11.
> > 
> > ...
> > [michael@localhost ~]$ cat ./bin/script
> > #!/bin/bash
> > # Sample shell script
> > echo "The date today is `date`"
> > echo Your shell is $SHELL
> > echo Your home directory is $HOME
> > echo The processes running on your system are shown below:
> > ps
> > 
> > [michael@localhost ~]$ script
> > Script started, file is typescript
> 
> The "which" command is useful to see how a command will be resolved.  If 
> you type:
> 
>     which script
> 
> you'll likely see something other than what you're expecting.

     The "which" command is not a good way to see how a command will
     be resolved. It is an external command (and at least one version
     will not work with bash), and it doesn't know about shell
     functions or aliases.

     The command to use is 'type'. With the -a option, it will tell
     you all of the possible commands that use the name. If you have a
     command, a function and an alias with the same name, it will list
     all three.

-- 
   Chris F.A. Johnson, webmaster         <http://woodbine-gerrard.com>
   ===================================================================
   Author:
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]