Re: help with bash functions Unix
From: Billy Patton (bpatton_at_ti.com)
Date: 12/16/04
- Next message: Christian Schneider: "Re: gcc cannot execute a.out"
- Previous message: jrefactors_at_hotmail.com: "gcc cannot execute a.out"
- In reply to: Chris F.A. Johnson: "Re: help with bash functions Unix"
- Next in thread: Ed Morton: "Re: help with bash functions Unix"
- Reply: Ed Morton: "Re: help with bash functions Unix"
- Reply: Stephane CHAZELAS: "Re: help with bash functions Unix"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 16 Dec 2004 12:19:42 -0600
On Thu, 16 Dec 2004, Chris F.A. Johnson wrote:
> On Thu, 16 Dec 2004 at 16:55 GMT, Billy Patton wrote:
>> if i have function:
>>
>> func_a ()
>> {
>> printf " I'm in '%s'\n" how_do_I_get_function_name;
>> ...
>> }
>>
>> How do I get the function name.
>>
>> I'll be writing a lot of these, lots of cutting and pasting.
>> It will be VERY easy to forget to change the name of the function
>> nested within the function.
>> So how do I get the name?
>
> In bash, there is the variable, FUNCNAME:
>
> func()
> {
> printf "FUNCNAME = %s" $FUNCNAME
> }
>
>
> I have never needed it; why do you?
abc ()
{
outdir=$OUTDIR/$FUNCNAME;
Just one way. For each task I will have a function by the same name It will
also be part of the output directory.
The more I can cut/paste without having to edit, the better off I am.
>
>
> --
> Chris F.A. Johnson http://cfaj.freeshell.org/shell
> ===================================================================
> My code (if any) in this post is copyright 2004, Chris F.A. Johnson
> and may be copied under the terms of the GNU General Public License
>
___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/
Texas Instruments ASIC Circuit Design Methodology Group
Dallas, Texas, 214-480-4455, b-patton@ti.com
- Next message: Christian Schneider: "Re: gcc cannot execute a.out"
- Previous message: jrefactors_at_hotmail.com: "gcc cannot execute a.out"
- In reply to: Chris F.A. Johnson: "Re: help with bash functions Unix"
- Next in thread: Ed Morton: "Re: help with bash functions Unix"
- Reply: Ed Morton: "Re: help with bash functions Unix"
- Reply: Stephane CHAZELAS: "Re: help with bash functions Unix"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|