bug-coreutils
[Top][All Lists]
Advanced

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

bug#26491: date and echo using with underscore


From: Reuti
Subject: bug#26491: date and echo using with underscore
Date: Fri, 14 Apr 2017 17:14:07 +0200

Hi,

> Am 14.04.2017 um 08:36 schrieb Edmond Yuen <address@hidden>:
> 
> Please verify the script below:
> 
> #/bin/bash
> 
> D=`date +%Y%m%d`
> i="someparameter"
> 
> echo $D_$i
> echo $D\_$i
> echo $D
> echo $i
> echo _
> 
> 
> 
> 
> //   my system is debian with coreutils 8.26-3
> //
> //   db=`date -d "-1day" +%Y%m%d`
> //   i="0"
> This is the result from my system
> 
> ~$ echo "$db_$i"
> 0
> ~$ echo "$db\_$i"
> 20170413\_0
> ~$ echo "$db$i"
> 201704130

The syntax is to use curly braces to limit the name of the varable:

echo "${db}_${i}"

-- Reuti





reply via email to

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