What does this part in the following code ?
if [ ".$t" != . ]; then
$t shows some time values for getting the response, but why .$t and what does the . after the !=
t=$(time -p wget --quiet --post-data='username=xxx&password=xxxx&id=xxxxxx' --no-check-certificate --output-document=/tmp/sms-status_out --timeout=30 "https://www.xxx.de/gsm/status.php" | perl -ne 'print int($1 * 1000) if /^real (\S+)/')
if [ ".$t" != . ]; then
thx
Alex
Scott
2
Hi.
It's one way of showing if $t is set or not.
If t is not set then the statement would expand to
if [ . != . ]; then
which is false.
If t is set to, say A, then that becomes
if [ .A != . ]; then
which is true, thus if $t is set, the if statement is executed, otherwise the else part (iif one exists) is.
It's a workaround for pre-POSIX shells.
It's a convoluted way of doing:
if [ -n "$t" ]