Whence Command
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix questions > Whence Command




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Whence Command  
amerar@iwc.net


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-24-06 11:23 PM


Hi All,

I see this command at the top of a script in our
establishment......what is the $0 represent??

myfile=`whence $0`

Thanks






[ Post a follow-up to this message ]



    Re: Whence Command  
Steve Foley


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-24-06 11:23 PM

$0 is the command used to invoke the script.

If the same script is linked to foo and foobar, this will tell you which one
you picked.



<amerar@iwc.net> wrote in message
news:1138119068.159497.232760@g44g2000cwa.googlegroups.com...
>
> Hi All,
>
> I see this command at the top of a script in our
> establishment......what is the $0 represent??
>
> myfile=`whence $0`
>
> Thanks
>







[ Post a follow-up to this message ]



    Re: Whence Command  
amerar@iwc.net


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-24-06 11:23 PM


So, what do these lines prove???

myfile=`whence $0`
mypath=`dirname $myfile`






[ Post a follow-up to this message ]



    Re: Whence Command  
Steve Foley


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-24-06 11:23 PM

what does the whence command do?


<amerar@iwc.net> wrote in message
news:1138120422.459703.212860@g49g2000cwa.googlegroups.com...
>
> So, what do these lines prove???
>
> myfile=`whence $0`
> mypath=`dirname $myfile`
>







[ Post a follow-up to this message ]



    Re: Whence Command  
Bill Marcum


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-25-06 01:56 AM

On Tue, 24 Jan 2006 16:58:51 GMT, Steve Foley
<steve.foley@DELETE.att.net> wrote:
> what does the whence command do?
>
What does the man command do?
Whence may be a builtin command.  Try "type whence" and, if it is
builtin, read the man page for your shell.


--
... Logically incoherent, semantically incomprehensible, and legally ...
impeccable!





[ Post a follow-up to this message ]



    Re: Whence Command  
Steve Foley


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-25-06 07:58 AM

I've got a DG/UX system, and a Linux/Mandrake 10.1. Neither has a whence
command or builtin.


"Bill Marcum" <bmarcum@iglou.com> wrote in message
news:s9sia3-1uu.ln1@don.localnet...
> On Tue, 24 Jan 2006 16:58:51 GMT, Steve Foley
>   <steve.foley@DELETE.att.net> wrote: 
> What does the man command do?
> Whence may be a builtin command.  Try "type whence" and, if it is
> builtin, read the man page for your shell.
>
>
> --
> ... Logically incoherent, semantically incomprehensible, and legally ...
> impeccable!







[ Post a follow-up to this message ]



    Re: Whence Command  
Aawara Chowdhury


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-25-06 07:58 AM

In <fhCBf.292825$qk4.4577@bgtnsc05-news.ops.worldnet.att.net>,
Steve Foley <steve.foley@DELETEatt.net> wrote:

> I've got a DG/UX system, and a Linux/Mandrake 10.1. Neither has a whence
> command or builtin.
>

Use the Korn shell on either, and you'll have a whence command (its a ksh
builtin).

AC
--
In America, through pressure of conformity, there is freedom of choice,
but nothing to choose from - Peter Ustinov.





[ Post a follow-up to this message ]



    Re: Whence Command  
Stephane CHAZELAS


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-25-06 07:58 AM

2006-01-25, 03:30(+00), Steve Foley:
> I've got a DG/UX system, and a Linux/Mandrake 10.1. Neither has a whence
> command or builtin.
[...]

It's a builtin in ksh and zsh, and does the same job as "type" but
with many options and a different syntax.

See the useful "whence -m <pattern>" in zsh to search for
commands with a pattern.

$ whence -apm '?sh'
/bin/ash
/usr/bin/ssh
/usr/bin/bsh
/usr/bin/ksh
/usr/bin/zsh
/bin/csh
/usr/bin/rsh

In zsh, "type" is "whence -v", "where" is "whence -ca", "which"
is "whence -c".

--
Stéphane





[ Post a follow-up to this message ]



    Re: Whence Command  
Steve Foley


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-30-06 02:31 AM

myfile is would be the fully qualified name of your script.

mypath is the fully qualified name of the directory where your script was
invoked from.



<amerar@iwc.net> wrote in message
news:1138120422.459703.212860@g49g2000cwa.googlegroups.com...
>
> So, what do these lines prove???
>
> myfile=`whence $0`
> mypath=`dirname $myfile`
>







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:20 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register