[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gawk] How to test if a variable is uninitialized or is just a varia
From: |
Peng Yu |
Subject: |
[bug-gawk] How to test if a variable is uninitialized or is just a variable that happens to be an empty string? |
Date: |
Mon, 8 Oct 2012 20:43:57 -0500 |
Hi,
I'm not able to find a function to test if a variable is uninitialized
or is just a variable that happens to be an empty string in the
manual. Is there such a function in awk? Thanks!
~/linux/test/awk/lang/variable/undefined$ cat main.sh
#!/usr/bin/env bash
echo | awk 'BEGIN{print "^" x "$"}'
echo | awk 'BEGIN{if(x=="") { print "Hello World!" }}'
echo | awk 'BEGIN{x=""; if(x=="") { print "Hello World!" }}'
--
Regards,
Peng
- [bug-gawk] How to test if a variable is uninitialized or is just a variable that happens to be an empty string?,
Peng Yu <=