[Top][All Lists]

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

Re: How to test if a variable is declared?

From: Pier Paolo Grassi
Subject: Re: How to test if a variable is declared?
Date: Fri, 13 Mar 2020 14:20:37 +0100

Hi Peng, from your focus on reducing cpu usage it seems to me you are
trying to do something for which bash maybe isn't the right tool
Hence some frustration can arise from your very specific but apparently
unmotivated needs
maybe you can try explaining what you are trying to achieve and the
constraint that you have, and ask for the list opinion on whether this is
achievable or not

Il giorno ven 13 mar 2020 alle ore 14:16 Peng Yu <address@hidden> ha

> I also said along the line of [[. I probably should make it more clear that
> I just want to test if a variable is declared but not anything else.
> On Fri, Mar 13, 2020 at 8:11 AM Eli Schwartz <address@hidden>
> wrote:
> > On 3/13/20 8:55 AM, Peng Yu wrote:
> > > This still prints. It just got redirected to null. So when the variable
> > > contains a long string, it will use extra CPU for a test that could be
> > made
> > > more light weight. So there is no way to just test if a variable is
> > > declared in bash?
> >
> > Is "no, there isn't" an acceptable answer?
> >
> > The closest you will get is printing it out to null, and testing the
> > return status of that print.
> >
> > P.S. If your initial response is "I don't want it to print to the
> > screen", and then when someone shows you how to not print to the screen
> > and you change your mind and say "I don't want it to print at all", it
> > gets rather frustrating. Maybe it would be beneficial if you list your
> > conditions from the start, rather than waiting for people to give you
> > answers you don't like?
> >
> > --
> > Eli Schwartz
> > Arch Linux Bug Wrangler and Trusted User
> >
> > --
> Regards,
> Peng

reply via email to

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