help-bash
[Top][All Lists]
Advanced

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

Re: Avoiding a shebang to call awk


From: alex xmb ratchev
Subject: Re: Avoiding a shebang to call awk
Date: Tue, 21 Feb 2023 09:16:15 +0100

On Tue, Feb 21, 2023, 8:24 AM goncholden <goncholden@protonmail.com> wrote:

> ------- Original Message -------
> On Tuesday, February 21st, 2023 at 5:51 PM, alex xmb ratchev <
> fxmbsw7@gmail.com> wrote:
>
>
> > On Tue, Feb 21, 2023, 12:14 AM goncholden via help-bash@gnu.org wrote:
> >
> > > Have read that employing a shebang to call awk in an awk file has no
> > > worthwhile benefit over making a shell function. Is this correct ?
> >
> >
> >
> > i dont understand your english
> > awk is data processing language , bash a cmds shell | execute
> > both have different working topics
>
> I have make an awk file named "tool.awk".  But I want to use its name
> "tool" rather than having to call awk directly.
>

i think but i am not sure , awk , or gawk
may search for file specified in AWKPATH but also maybe PATH
u can also simply link or cp the .awk to a bin dir , without .awk naming ,
and chmod +x , and there u got ur cmd

Originally I had a shebang, namely "#!/bin/awk -f" in the file "tool.awk".
>

i for wanting have such written , .. more clear that awk follows
maybe see < ad >  get-egg http://0x0.st/HsuV.sh
.. the gawk line around on end ..

>
> I have removed the awk shebang from the file and added a bash function
>
> tool ()
> {
>   local epath="${HOME}/Opstk/bin//opcon"
>   awk -f "${epath}"/tool.awk "${@:--}"
> }
>

a similiar alternative is
reading the .awk to a var
# mapfile -d '' myawk <path/file
normally u dont have \0 s there so it reads , else is not so fatal too
but in case of var

myawk() { awk "$myawk" "$@" ; }
same as
alias myawk='awk "$myawk" '

>


reply via email to

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