variables not concatenating in BusyBox

sharkyenergy

Following code puts the proper value in $monthdata and $daydata but when I try to print them out concatenated it does not work.

month05="AD"
day25="QGTKDO"

curmonth=$(date +"%m")
eval monthdata="\$month$curmonth"
curday=$(date +"%d")
eval daydata="\$day$curday"
c="$monthdata$daydata"

echo $c

This echo outputs "QGTKDO". If c="$daydata$monthdata" then the output is "ADTKDO", as if instead of concatenating it overlays them. I Am on BusyBox v1.23.1

Armali

Sounds like your script has DOS line-endings (so the strings do). Try running dos2unix or similar on it. Also see the bash info page as this is one of the first suggestions on there. – Etan Reisner

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Concatenating variables and strings in React

From Dev

Concatenating strings and variables in batch

From Dev

Concatenating PowerShell variables

From Dev

Concatenating Variables within Powershell

From Dev

Concatenating two variables with an underscore

From Dev

Concatenating selectors that include variables

From Dev

Concatenating variables in PowerShell

From Dev

Concatenating the Razor Variables with CSS Styles

From Java

concatenating string variables to obtain value

From Dev

Concatenating two string variables in r

From Dev

Concatenating strings and calculated variables in table

From Dev

Concatenating characters/numbers to represent variables in Javascript?

From Dev

Concatenating two or more struct-type variables in MATLAB

From Dev

Using concatenating assignment operator for 2 variables same time

From Dev

how to clean noise character from the concatenating variables in XSLT

From Dev

Concatenating two or more struct-type variables in MATLAB

From Dev

SQL - Help me Select the result of concatenating two variables in a stored procedure

From Dev

when concatenating two xsl variables i get : An XPath expression was expected to return a NodeSet

From Dev

BusyBox at 17.04

From Dev

Concatenating ImmutableLists

From Dev

Concatenating in for loop

From Dev

Concatenating bits

From Dev

Concatenating substring?

From Dev

Concatenating JSTL

From Dev

Concatenating Columns

From Dev

Concatenating Arrays

From Dev

Concatenating substring?

From Dev

Python - Concatenating

From Dev

Concatenating in selector