'How to create and assign a variable name with special character in bash
Sorry if this question is repeated.
how can I create a variable a.b and assign a value to it.
----------
root@IN2268980W3:# a=1
root@IN2268980W3:# a.b=1
a.b=1: command not found
root@IN2268980W3:# a.b='1'
a.b=1: command not found
root@IN2268980W3:# 'a.b'='1'
a.b=1: command not found
root@IN2268980W3:# 'a\.b'='1'
a\.b=1: command not found
root@IN2268980W3:#
-----
I need this for testing.
Solution 1:[1]
Standard editions of bash don't allow dots (.) in variable names. The backslash escape \ does not fix the problem as well.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | pr0logas |