|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi all,
I have one setup in my .profile ie (along with the normal set/ alias...etc) export ENV=${HOME}/.profile inorder to run my profile file whenever i want to change into korn shell. But interesting think is .profile is also executed when i run 'which' command $which ls Setting .profile.mine .... $ I just want to know why ".profile" is execute whenever i run `which` command. Regards, San. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On 2007-07-19, sangeethabvn@gmail.com wrote:
> Hi all, > > I have one setup in my .profile ie (along with the normal set/ > alias...etc) > export ENV=${HOME}/.profile > > inorder to run my profile file whenever i want to change into korn > shell. But interesting think is .profile is also executed when i run > 'which' command > > $which ls > Setting .profile.mine .... > $ > > I just want to know why ".profile" is execute whenever i run `which` > command. Which version of which are you using? What does the man page say? Why use which? What's wrong with type? -- Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell/> Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) ===== My code in this post, if any, assumes the POSIX locale ===== and is released under the GNU General Public Licence |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
I have found the answer for my question. Actually, my default login
shell is csh, i'm having "/bin/ksh" in the .cshrc. It looks like ' which' command executes ".cshrc" whenever I type ' which ' command. ( I've traced the ' which ' command's exection flow, by adding "echo" statments in all these files) On Jul 19, 9:40 pm, "Chris F.A. Johnson" <cfajohn...@gmail.com> wrote: > On 2007-07-19, sangeetha...@gmail.com wrote: > > Hi all, > > > I have one setup in my .profile ie (along with the normal set/ > > alias...etc) > > export ENV=${HOME}/.profile > > > inorder to run my profile file whenever i want to change into korn > > shell. But interesting think is .profile is also executed when i run > > 'which' command > > > $which ls > > Setting .profile.mine .... > > $ > > > I just want to know why ".profile" is execute whenever i run `which` > > command. > > Which version of which are you using? > > What does the man page say? > > Why use which? What's wrong with type? > > -- > Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell/> > Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) > ===== My code in this post, if any, assumes the POSIX locale > ===== and is released under the GNU General Public Licence- Hide quoted text - > > - Show quoted text - |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
In article <1184930134.503419.175460@d30g2000prg.googlegroups .com>,
sangeethabvn@gmail.com wrote: > I have found the answer for my question. Actually, my default login > shell is csh, i'm having "/bin/ksh" in the .cshrc. It looks like ' > which' command executes ".cshrc" whenever I type ' which ' command. > ( I've traced the ' which ' command's exection flow, by adding "echo" > statments in all these files) 'which' is a C shell script, and it executes .cshrc to ensure that its environment (in particular, $PATH) will be the same as an interactive shell, so that it can tell you where in your $PATH it finds the command. > > On Jul 19, 9:40 pm, "Chris F.A. Johnson" <cfajohn...@gmail.com> wrote: > > On 2007-07-19, sangeetha...@gmail.com wrote: > > > Hi all, > > > > > I have one setup in my .profile ie (along with the normal set/ > > > alias...etc) > > > export ENV=${HOME}/.profile > > > > > inorder to run my profile file whenever i want to change into korn > > > shell. But interesting think is .profile is also executed when i run > > > 'which' command > > > > > $which ls > > > Setting .profile.mine .... > > > $ > > > > > I just want to know why ".profile" is execute whenever i run `which` > > > command. > > > > Which version of which are you using? > > > > What does the man page say? > > > > Why use which? What's wrong with type? > > > > -- > > Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell/> > > Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) > > ===== My code in this post, if any, assumes the POSIX locale > > ===== and is released under the GNU General Public Licence- Hide quoted > > text - > > > > - Show quoted text - -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group *** |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
Chris F.A. Johnson wrote:
> On 2007-07-19, sangeethabvn@gmail.com wrote: >> Hi all, >> >> I have one setup in my .profile ie (along with the normal set/ >> alias...etc) >> export ENV=${HOME}/.profile >> >> inorder to run my profile file whenever i want to change into korn >> shell. But interesting think is .profile is also executed when i run >> 'which' command >> >> $which ls >> Setting .profile.mine .... >> $ >> >> I just want to know why ".profile" is execute whenever i run `which` >> command. > > Which version of which are you using? > > What does the man page say? > > Why use which? What's wrong with type? > > Well, i like "which" because i can do this: vi `which somescript.sh` In our env some of the stuff is in rather long paths. The PATH var is quite long,(its a specialized testing environment) and the directory structure not so well thought out, so using the above trick i can bring it up in vi rather easily without having to know where some bonehead put the fool thing. Eric |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
On 23 Jul., 10:27, Eric <No...@invalid.com> wrote:
> Chris F.A. Johnson wrote: > > On 2007-07-19, sangeetha...@gmail.com wrote: > >> Hi all, > > >> I have one setup in my .profile ie (along with the normal set/ > >> alias...etc) > >> export ENV=${HOME}/.profile > > >> inorder to run my profile file whenever i want to change into korn > >> shell. But interesting think is .profile is also executed when i run > >> 'which' command > > >> $which ls > >> Setting .profile.mine .... > >> $ > > >> I just want to know why ".profile" is execute whenever i run `which` > >> command. > > > Which version of which are you using? > > > What does the man page say? > > > Why use which? What's wrong with type? > > Well, i like "which" because i can do this: > vi `which somescript.sh` > In our env some of the stuff is in rather long paths. Either have a look at possible options to 'type' in your environment to omit the prefix string "<prg> is [cached] ..." in the output, or, since you use ksh, have a look at the 'whence' command instead. Janis > The PATH var is quite long,(its a specialized testing environment) > and the directory structure not so well thought out, so using the above > trick i can bring it up in vi rather easily without having to know where > some bonehead put the fool thing. > Eric |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
On 2007-07-23, Eric wrote:
> Chris F.A. Johnson wrote: > >> On 2007-07-19, sangeethabvn@gmail.com wrote: >>> Hi all, >>> >>> I have one setup in my .profile ie (along with the normal set/ >>> alias...etc) >>> export ENV=${HOME}/.profile >>> >>> inorder to run my profile file whenever i want to change into korn >>> shell. But interesting think is .profile is also executed when i run >>> 'which' command >>> >>> $which ls >>> Setting .profile.mine .... >>> $ >>> >>> I just want to know why ".profile" is execute whenever i run `which` >>> command. >> >> Which version of which are you using? >> >> What does the man page say? > >> Why use which? What's wrong with type? >> > Well, i like "which" because i can do this: > vi `which somescript.sh` > In our env some of the stuff is in rather long paths. > The PATH var is quite long,(its a specialized testing environment) > and the directory structure not so well thought out, so using the above > trick i can bring it up in vi rather easily without having to know where > some bonehead put the fool thing. In bash I can do: emacsclient `type -p somescript.sh` -- Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell/> Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) ===== My code in this post, if any, assumes the POSIX locale ===== and is released under the GNU General Public Licence |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
Janis wrote:
>> Well, i like "which" because i can do this: >> vi `which somescript.sh` >> In our env some of the stuff is in rather long paths. > > Either have a look at possible options to 'type' in your environment > to omit the prefix string "<prg> is [cached] ..." in the output, or, > since you use ksh, have a look at the 'whence' command instead. Or just use "command -v" which is POSIX/SUS standard. -- Geoff Clare <netnews@gclare.org.uk> |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
Janis wrote:
>> Well, i like "which" because i can do this: >> vi `which somescript.sh` >> In our env some of the stuff is in rather long paths. > > Either have a look at possible options to 'type' in your environment > to omit the prefix string "<prg> is [cached] ..." in the output, or, > since you use ksh, have a look at the 'whence' command instead. Or just use "command -v" which is POSIX/SUS standard. -- Geoff Clare <netnews@gclare.org.uk> |
|
![]() |
| Outils de la discussion | |
|
|